8 Tidbits from WWDC23
visionOS, Swift Macros, SwiftData, Observation and Symbols frameworks: these are just some of the most important news from the Apple WWDC23. But as every year, there’re also a bounce of minor features and improvements: let’s discover 8 tidbits that could be interesting for your daily work.
1. Xcode Cloud test notes
You’ll be able to include notes for your beta distributed from Xcode Cloud through TestFlight: just create a TestFlight
folder in your project’s root and add a WhatToTest.en-US.txt
file with the notes.
Thanks to scripting, you can also automate what to write in the notes: in the session and related documentation, it’s explained how to include the last commit message with a post build script. But let’s say you’re defining a workflow where a new build is made for every feature pr opened and your branch naming convention includes the id of the ticket you’re working on: instead of the commit message, with git rev-parse --abbrev-ref HEAD
the full branch name will be written in the test notes, so tester can reference to the pr associated ticket easily.
2. XCTest screen recording
XCTest now supports automatic screen recordings, particulary useful with UITests; it’s one of the many improvements in testing in Xcode 15, including an improved test navigator, test report and a new Test Details view.
3. New viewIsAppearing callback
This new view controller callback is a really good addition: it’s called once each time a controller’s view appears, between viewWillAppear
and viewDidAppear
. Unlike viewWillAppear
, it’s called when controller’s view has already been added to the view hierarchy, so with updated trait collections and accurate geometry. Unlike viewDidAppear
, it’s called way before animations/transitions are completed. Most importantly: it back-deploys to iOS 13 🎉. You can find the full documentation here.
4. Palette Menu
UIMenu has a new option to display menu items in a row: just use .displayAsPalette
as UIMenu.Options
in your menu init.
5. UIPageControl progress
By setting the new progress
property of UIPageControl
, the active indicator will show the page progress. UIPageControlTimerProgress
has a built-in timer to set the duration and a UIPageControlTimerProgressDelegate
to control the page scroll, but there’s also UIPageControlProgress
to follow external timers or video playback:
let progress = UIPageControlTimerProgress(preferredDuration: 5)
progress.delegate = yourDelegate
progress.resetsToInitialPageAfterEnd = true
pageControl.progress = progress
progress.resumeTimer()
6. Widgets background handling
To better align your widgets UI with new places where it can be added, like iPad Lockscreen, iPhone StandBy mode or Apple Watch Smart Stack, it could be useful to remove its background. The new .containerBackground
modifier automatically removes the background you define depending on the kind of the widget is being displayed:
struct NewsWidgetEntryView: View {
var entry: Provider.Entry
var body: some View {
VStack() {
...
}
.containerBackground(for: .widget) {
Color.yourBackgroundColor
}
}
}
7. SwiftUI Haptic feedback
Thanks to the new .sensoryFeedback
modifier, you can easily add an haptic feedback in response to an event, like a tap on a button:
struct ContentView: View {
@State private var saved = false
var body: some View {
Button("Save") {
saved = true
}
.sensoryFeedback(.success, trigger: saved)
}
}
8. New Font TextStyles
There’re 2 new UIFont TextStyle: .extraLargeTitle
which is 36 points bold; .extraLargeTitle2
which is 28 points bold. In SwiftUI, these new styles seem to be available only for visionOS target (probably a beta bug).
Bonus: UIStatusBar default behavior
This is great: on iOS 17, status bar using a .default
style will continuously adapt to the underneath content and automatically change between light and dark, even by split style between right and left sides. You can see the effect in the UIPageControl progress GIF above.