New developer tools unveiled at WWDC: Xcode Cloud, Swift and SwiftUI
Apple’s announcement of a continuous integration and continuous delivery (CI/CD) service called Xcode Cloud was one of the most interesting news items at this year's WWDC. Xcode 13 also brings us Swift 5.5 and Swift UI 3.0.
Apple’s announcement of a continuous integration and continuous delivery (CI/CD) service called Xcode Cloud was one of the most interesting news items at this year’s WWDC. Xcode 13 also brings us Swift 5.5 and Swift UI 3.0.
In addition to new icons and other minor UI refinements, Xcode 13 comes with tons of small updates and several more notable add-ons.
New collaborative features make it easier to review code changes and provide feedback directly from Xcode. The DocC document compiler generates native Apple-style API documentation for Swift frameworks. Generated documentation is viewable in Xcode and can be exported as html.
Debug tools got some minor but welcome updates, as it’s now possible to inspect and visualize URLSession’s http traffic using Instruments. Some developers might be delighted to hear that Xcode now supports vim key bindings (Tip: close vim with : Esc > Shift + ZZ).
Native support for CI/CD with Xcode Cloud
Many developers are self-hosting their mobile CI/CD pipelines and have to rely on third-party tools which aren’t always that great. This comes with initial set-up costs and labour-intensive maintenance.
Apple has now developed a more accessible solution for iOS and Mac developers and offers to run their build-test-deploy cycles on Apple’s cloud infrastructure.
Everything is tightly integrated into Xcode, and pipeline steps can be set up directly from the UI. You can configure build environments with multiple macOS and Xcode versions and execute tests against several platforms and iOS simulators in parallel.
Webhooks and custom build scripts are supported as you’d expect. Builds can be automatically signed in the cloud and deployed to App Store or TestFlight for both iOS and Mac, as TestFlight is now supported on macOS as well.
Privacy concerns are addressed with data encryption and isolated, temporary build environments. Apple is advertising that Xcode Cloud will be customizable to your existing development and distribution processes.
The announcement of Xcode Cloud comes three years after Apple acquired Vancouver-based cloud CI/CD start-up BuddyBuild in 2018. BuddyBuild was ordered to shut down by Apple in March this year.
What’s new in Swift and SwiftUI? Something we’ve long been waiting for.
As any follower of Swift forums will already know, Swift version 5.5 comes with major new concurrency features: actors and async/await. Actor is a new reference type that ensures its data is accessed only one thread at a time to prevent race conditions.
Async and await makes it possible to write asynchronous code that follows normal synchronous execution flow. This lets you avoid nested callbacks and reduces complexity. A great in-depth article about async/await is available here.
SwiftUI 3.0 is continuing to catch up with UIKit. Several missing controls and modifiers have been added, such as refreshable actions and swipe actions. SwiftUI makes use of Swift 5.5’s new async/await features in the AsyncImage method, which can be used to load images asynchronously in the background. The new Canvas API is equivalent to UIKit’s drawRect, which allows immediate-mode drawing.
Conclusion
WWDC 2021 was very lean and didn’t bring any groundbreaking changes to Apple’s ecosystem. Instead, we got a couple of new tools and some predictable framework improvements. This can be a good thing, as developers often aren’t too excited about sweeping changes.
Xcode 13 is currently in beta and available for download at developer.apple.com. Xcode Cloud is now in limited beta and comes integrated into Xcode 13 and App Store Connect web. Pricing and general availability are still unknown.
Illustration: Joel Pöllänen