What's new at WWDC 2021 | Part 2
Part 2 of WWDC 2021 highlights: Swift Refactoring, AttributedString with Markdown, Xcode 13 features, AsyncImage and Swift Package Collections.
This is the continuation of the previous post. Here we’ll go deeper into language topics, especially SwiftUI where Apple has shown the most improvements.
6. Swift Refactoring
Looking at this section in Apple’s documentation, it says we can practically apply “refactor” to a portion of code to migrate it to async style. It surely won’t apply to all cases but the change is welcome and interesting, to adopt async more quickly.
7. Markdown support for AttributedString in SwiftUI
Now we can use an attributed string in SwiftUI using the Markdown format:
let string = try AttributedString(markdown: "page link")
Apple documentation: AttributedString
8. New Xcode 13 features
Collaboration features. Xcode now adds new collaboration features for the development team, compatible with Xcode Cloud, GitHub, Bitbucket and GitLab. You’ll now be able to initiate, review, merge and create pull requests from Xcode, view your teammates’ comments directly in the code and quickly compare different versions. Something we currently handle through other tools, but having it directly integrated in the IDE is greatly appreciated — one of the features many people will love.
Code comments. This feature is also excellent. We currently solve this from whatever platform we’re working on. But having it directly in the IDE will save a lot of time.
Quick compare. Now you’ll have a view that lets you compare between two versions of code, directly from the current editing context.
Cloud Signing. Now you’ll only need to enter your Apple ID and your Mac will be configured for development and deployment based on the roles you currently have assigned in your developer account — all automatically.
Vim mode. Many key combinations and editing modes familiar to Vim users will be supported directly in the Xcode editor. In the bottom bar you can see indicators of which mode you’re working in.
Crash reports and comments. All crash reports that users send us from TestFlight will appear in the Organizer section in Xcode within just a few minutes, including the complete comments with tester feedback — so they can tell you exactly what happened when they experienced the crash. The crash log will be displayed when you click it and will also send you directly to the line of code where the failure occurred.
9. Build version
Now the version sent for store review can detect if we have a valid build number. If not, or if we have an incorrect one that repeats a previous one, it will offer the option to increment it automatically, without needing to upload a new version.
This I think will also help a lot to avoid those annoying re-upload attempts when you forget to bump the build number.
10. Swift Package Manager Collections
Available now. It’s an excellent addition to Apple’s current dependency manager and lets us use and specify collections of dependencies, mainly for discovering packages and deciding which are best for our project.
It’s designed to have lists of trusted package providers — someone you already trust — rather than searching around the internet to see what you find.
There are already some official provider lists:
- Swift Server Workgroup: Part of the Swift project, they’ve published their collection of packages incubated by the group. swift.org/sswg
- Swift Package Index: Created a website that dynamically generates collections of Swift packages. swiftpackageindex.com
- Apple’s OSS Swift Package: The official collection, will be included by default with Xcode 13.
Finally, you can also create your own collection and share it with the world. It will use a signing process similar to apps, to verify authenticity and integrity of packages.
11. AsyncImage
This is a new SwiftUI control that will let us set remote images in our views. This control will download the image for us and place it automatically. We can control how to handle the results, place a placeholder in case of error — all through the same control:
AsyncImage(url: model.imageURL)
With these incredible changes we conclude this post series. Without doubt in the future I’ll be working on some specific topics and will start writing tutorials about the new things we saw at WWDC. Greetings to everyone.