Under The Bridge Under The Bridge

Tag: SPM
This Xcode Goes To 11

Well, this has been a particularly exciting year on the Xcode front, hasn’t it?

  • Xcode 11 supports development with SwiftUI
  • SwiftUI live views and inline results in playgrounds are supported…
  • Xcode 11 adds support for Mac Catalyst to bring iPad apps to the Mac…
  • Xcode now supports creating and working with Swift packages, as well as adding, removing, and managing package dependencies…
  • An XCFramework makes it possible to bundle a binary framework or library for multiple platforms…
  • The new Metrics organizer shows battery life and performance analytics for your app to help you drive optimizations…
  • Xcode 11 supports the new Apple Development and Apple Distribution certificate types. These certificates support building, running, and distributing apps on any Apple platform…
  • Metal is available in iOS 13 and tvOS 13 simulators when running on macOS 10.15…
  • Introduces the ability to view inline code diffs for changes in the Source Editor…

Not sure “particularly exciting” covers it actually, this is the biggest Xcode update in the history of ever far as we can remember! Read the whole thing, and then the latest point release notes up to 11.3 Beta as we type this; and here’s a couple particularly good visual-enhanced tours of the new goodies:

Xcode: All the Way to 11

What’s new in Xcode 11? [Updated for 11.1 and 11.2]

Personally, this version of Xcode is a veritable benediction, given how many years we’ve been desperately looking forward to disposing of third party dependency managers…

Ready for Swift Package Manager?

Replacing CocoaPods with Swift Package Manager

Launching the SwiftPM Library + SwiftPM Catalog

…and once more being able to use workspaces as actual, y’know, workspaces. We’re not quite there with our latest project — the last serious roadblock is Firebase requiring binary framework support — but we are very close indeed! Mind you, we did have to do some considered refactoring to dispose of some pods that weren’t Pure Swift™, there’s a good if overly despondent summary of the various existing drawbacks here:

Dependency Heck

The state of iOS dependency management in 2019 is not great, and might get worse before it gets better…

Although we disagree with that completely, it’s orders of magnitude better than Xcode 10 even with the loose ends lying about still and getting better by the day, we say! In the meantime, aside from the third party dependency migration pains, even more important in the future is it’s much easier now to manage your internal dependancies and modularity with SPM:

Update your existing iOS Framework to Swift Package

Creating Swift Packages in Xcode + Editing A Swift Package

Managing dependencies using the Swift Package Manager

And that’s about enough for SPM for now. Next thing we’d like to highlight from that intro list is what drives that Metrics organizer, in case you’d overlooked it so far:

MetricKit

With MetricKit, you can receive on-device app power and performance metrics captured by the system. A registered app receives reports containing data about the previous 24 hours at most once per day…

Introduction at Improving Battery Life and Performance

NSHipster has a deeper dive in Metric​Kit

And for a really deep dive, check out MetricKit Internals!

SwiftUI and Catalyst are going to require some deep, deep diving of their own; for now, we’ll list miscellaneous other new and old Xcode tips we’ve collected since The Xth-Code Files: Xcode 10 Tips:

one small change for xcode, one giant leap for productivity

XCode allows you to take a snapshot of the state of the app you are developing and restore it later when you run the app or run the tests. Pretty cool!

Xcode 11 environmental overrides

Have you used the accessibility inspector to change the dynamic type size of your running app? Did you know you can do that directly from the debugger with Xcode 11? Even better, it allows you to override the interface style to quickly switch between light and dark modes…

Sherlock turbocharges your iOS simulator

There aren’t many times outside of WWDC where Apple developers see a new tool and immediately think “I need that in my life.” Sherlock by Inspired Code is one such tool: it injects itself into the iOS Simulator so that it can monitor views and adjust them in real time…

NSHipster’s simctl has Simulator tips you really want to know about

Better Storyboards with Xcode 11

Using Xcode Previews with existing views without using SwiftUI

Add a View <> ViewModel Jump To Counterpart

XCAssetsKit: “.xcassets parser written in Swift”

QuickLook plugin to visualize .car files (compiled Asset Catalogs)

Speeding up with Xcode Behaviors

Awesome-Xcode-Behaviors

The fastest way to Xcode: “Using the power of aliases in your Terminal”

Xcode: Basics of the four-block wonder aka “Navigate to Related Items”

37 Xcode Tips and Shortcuts to speed up your daily development

Unused images and resources clean up in Xcode

Unused localized strings clean up from a Strings file

Variable Width Strings

Where the &$!#% Is Localizable.Strings?!?

PoeditApp: “The fastest and most convenient way to translate apps & sites with gettext”

Periphery: “A tool to identify unused code in Swift projects.”

Streamlining your development workflow with Xcode Templates

ios-project-template: “iOS project template with fastlane lanes, Travis CI jobs and GitHub integrations of Codecov, HoundCI for SwiftLint and Danger”

Building Faster in iOS with Bazel

Project generation: Introduction to development of Tuist: “Bootstrap, maintain, and interact with Xcode projects at any scale”

And finally, to remind us that not quite everything is better these days:

Xcode​Kit and Xcode Source Editor Extensions

When we last wrote about extending Xcode in 2014, we were living in a golden age, and didn’t even know it…

Ah well. There’s still some good ones out there — our Most Useful™ Award goes to

SwiftMockGeneratorForXcode — An Xcode extension (plugin) to generate Swift test doubles automatically.

Check it out!

Summer of Code 2018

Well, here’s some news that’s interesting and also apropos to our Letter To A Young Developer from last time: 

  1. Are you a student developer? (If you’re not, but you know any, keep reading)
  2. Are you interested in an open source internship? (Correct answer is: YES)
  3. Are you interested in SWIFT? (If you’re not, ok wrong blog you may go now)

OK then, here’s an opportunity for you to jump on:

Google Summer of Code 2018

2018SummerOfCode

13,000+ STUDENTS, 108 COUNTRIES
13 YEARS, 608 OPEN SOURCE ORGANIZATIONS

33,000,000+ LINES OF CODE

Google Summer of Code is a global program focused on bringing more student developers into open source software development. Students work with an open source organization on a 3 month programming project during their break from school…

Which is an interesting opportunity every year yes, but this year is particularly interesting if you have designs on the Apple ecosystem:

Swift to participate in GSoC 2018!

I am thrilled to announced that Swift has been selected as a participating open source project in Google Summer of Code 2018!

…  Student applications start on March 12, 2018

The official application to GSoC starts on March 12. Before then, we encourage all prospective participates to socialize their ideas on the respective Development forum categories. Please tag all posts with the GSoC 2018 tag so that they are easily discoverable by others (e.g., students and mentors) interested in GSoC.

There are several open project ideas available on Swift.org — but potential projects do not need to be restricted to these ideas. Regardless if you are looking into working on a suggested project or one of your own creation, you are strongly encouraged to engage on the forums before applications are accepted to help shape your idea and ensure a good alignment with a mentor.

… Key Dates
March 12 (16:00 UTC) – Applications open
March 27 (16:00 UTC) – Deadline to file your application
April 23 (16:00 UTC) – Accepted student proposals are announced
May 14 – Coding begins

Personally, we think a particularly useful place to help out would be the Swift Package Manager, and if that sounds interesting here is your mentor:

So, student developers, if you haven’t got a firm résumé-enhancing plan already in place for the summer, we strongly recommend you give very serious thought to the Summer of Code in general, and making Swift better for us all in particular!

Framework Package Flocking

Thinking of wrapping up some of your code for the public in a framework? Here’s two nice walkthroughs of the gritty details of setting that up for both CocoaPods and Carthage:

Creating your first iOS Framework

We’re going to build a framework that exposes a function called RGBUIColor(red:green:blue) that returns a new UIColor created from those values. We’ll build it using Swift, with Carthage as our dependency manager. Our framework will be consumable using Carthage, CocoaPods, or git submodules…

Creating Cross-Platform Swift Frameworks for iOS, watchOS, and tvOS via Carthage and CocoaPods

In this post, I’d like to show you how to create a Swift framework for iOS, watchOS, and tvOS and get them distributed via Carthage and CocoaPods… Check out one of my libraries that uses this method to see how it’s set up with real code and tests:

ZamzamKit

Good stuff, yep. But what if you want to support that upcoming hotness the Swift Package Manager? Why yes, here’s a presentation that’s got that sorted too:

Creating a Swift Library walks through producing Snorlax, “The ultimate lazy library”,

Snorlax currently supports the following platforms:

  • Mac OS X
  • iOS
  • tvOS
  • watchOS
  • Linux

Using the following Package Managers:

  • CocoaPods
  • Carthage
  • Swift Package Manager
  • Adding as an Xcode Subproject

That’s veritably exhaustive, that is.

If you just can’t wait for Swift 3 to try out SPM, check out

Dependency Management with the Swift Package Manager

But something not being officially released has never stopped inquisitive developers experimenting in the past. So in this article I will introduce the SPM, show you how to install it and existing packages, and how to create your own…

And once you’ve got your SPM library ready to go, be sure to submit it to the package catalog for SPM hosted by… wait, who?

IBM Swift Package Catalog

Create, share and discover the many new libraries, modules and packages being created since Swift moved to Open Source.

The IBM Swift Package Catalog enables the Swift.org developer community to leverage and share code across projects… Truly, these are strange times we live in, aren’t they now?

UPDATES:

CocoaPods 1.0: “I’m incredibly happy to say that, after an incredible four and a half years of development, we just released CocoaPods 1.0…”

SwiftPM Packages on GitHub: Statistics Creating Objective-C and C++ packages using Swift Package Manager Making Private, Cross-Platform Swift Frameworks With CocoaPods

Framework: “A template for new Swift iOS / tvOS / watchOS / macOS Framework project ready with travis-ci, cocoapods, Carthage, SwiftPM and a Readme file”

SwiftPlate: “Easily generate cross platform Swift framework projects from the command line.”

Using Swift Package Manager with Carthage Build a Universal Framework for iOS using Swift Using ‘swift package fetch’ in an Xcode project Building a command line tool using the Swift Package Manager

SwiftPlate: “Easily generate cross platform Swift framework projects from the command line”

Dependency Management for iOS projects with the Swift package manager

Swift Package Manager builds iOS frameworks