Alexito's World

A world of coding 💻, by Alejandro Martinez

WWDC23 notes

WWDC23 is over and as previous year I'm sharing my unedited notes from all the sessions I've watched.

This year has been quite entertaining as the main focus has been on the new platform, something that hasn't taken too much brain power of mine. visionOS is very cool, but it still feels like a very narrow and futuristic device. For what I care, the software and the engineering, there are two parts: apps as we know them, and new spatial design. For the first one there is not much difficult things to learn since is all based on all the farmeworks we know and love. For the spatial design it requires bringing 3Dc ontent into apps, which is a different discipline that although I've dabbled with, it's not in my priorities right now. The combination of that means all the visionOS talks have been a breeze to go trough, like watching a scifi show.

The rest of sessions have been on the usual topics and frameworks. In general I've found all of them quite straightforward, without anything new or revolutionary that would make by brain go boom. Most of this is thanks to Swift being open source, which removes the surprise factor of the things I'm interested in by a lot. I basically knew everything coming on that front already. So that leaves SwiftUI as the delightful surprise machine.

I'm not complaining, is good to have a year a bit more relaxed. Before WWDC started I already decided to take this year a bit calmed, for my own mental health. I could jump in the wagon of content generation but I prefer to enjoy it, treat it as entertainment and learn with it. It's way more fun!

Favorite sessions

After long nights and early mornings, I've watched more than 90 sessions. That's pretty much every single session that is not gaming, ML, web or business related 😂. It's not that much time when you watch it an higher speed ⏭️ I surprised even myself, but with all the sessions being quite low in new content time flew by, it was very enjoyable!

From all of those the ones I've kept bookmarket are:

Even if this year the content was not super impactful for me, every single session and presenter is amazing. The quality is over the clouds. They all are interesting to watch and listen, and present the topics in a very entertaining and interesting manner. And I love how Apple, a huge coorporation, let's every presenter add a bit of their own personality to the videos. It makes them so much approachable. My congratulations to all the ones involved in making this sessions so enjoyable!

Raw Notes

This won't include every detail in all sessions. The notes reflect things that have caught my attention and that I want to remember their existence for later. Details are best obtained by going to the documentation when needed knowledge is up to date.

Keynote

  • Stickers in third party apps like emojis?
  • Journal! gratitude and memories with suggestions from photos, music, trips...
    • suggestions api
    • health mood tracking with state of mind, assessments
    • Craig: "multiple timers, we truly live in an age of wonders."
    • vision health, how much time spent outdoors in sunlight, screen distance

SotU

With WidgetKit, you can surface your content in many places across the system. With App Intents, your app's functionality is integrated into the system even more seamlessly. With TipKit, you can surface beautiful tips directly in your app. And with AirDrop, you can make it even more convenient for your users to share content with those nearby.

  • WidgetKit
    • Available on StanBy mode, lockscreen on ipad, and mac desktop. with background removed.
    • Identify the background (.containerBackground modifier) and update its padding (remove it, it comes by default now).
    • Interactivity with buttons and toggles to trigger App Intents.
    • Transitions supported.
    • TipKit
    • Configure tooltips to be displayed to users with rules. Sync across devices.
    • Values:
    • Accessibility:
      • new pause animated images flag
      • avoid bright flashing lights in videos
    • Privacy
    • App Store
    • New swiftui api to make the subscribe screens following apple standards.
    • Xcode
    • Code generation for asset catalogs
    • Macro for swiftui previews (and for uikit and appkit!)
    • visionOS
    • Windows, Volumes and Spaces
    • Existing apps are just using Windows, but if you rebuild you get the proper look and feel with materials.
    • ZStacks can have depth.
    • Mix SwiftUI with RealityKit.
    • Ornaments fix UI elements to the side of the window, great for toolbars and menus.
    • Hover effects where the user looks.

SwiftUI

Charts

  • Pie and Donut charts with new SectorMark
  • Chart Selection that automatically handles the gesture recognitizers to allow selection along axis, ranges and angles. Allows to provide a custom gesture whilte still making it easy to select the value based on the gesture location.
  • Scrollable with chartScrollableAxis and specify the visible domain. It also supports scroll target behaviours.

Inspectors

Views that show further detail of selected content. Is a right sidebar that adapts to a sheet on smaller sizes.

Presentation

New presentationBackground to change the background of the sheets overlays, the overlay that covers the entire screen.

presentationBackgroundInteraction let's you enable the interaction of the content behind even when a sheet is up.

presentationCornerRadius(_:)

presentationContentInteraction(_:)

presentationCompactAdaptation(_:) Some of these modifiers also work when Inspectors are presented as sheets.

Animations

Phases:

  • loop between phases applying styles on each one.
  • starts immediately on appearance
  • or pass a trigger to animate when it changes

Keyframes:

  • Run parallel animation tracks, inside each track is a sequence
  • Refreshes the view on every frame
  • MapKit has support to keyframe the camera
  • KeyFrameTimeline allows you to evaluate an animation, and even display it in a chart.

UnitCurve and Spring contain the algorithms/curves that drive the change of values. You can use them directly to get a value at a specific point in time.

CustomAnimation protocol to write custom animation curves. Can impleemnt velocty and merge behaviour to mix with other animations that was triggered while another was running.

Transaction is now public. Is another implicit-data flow construct, a dictionary that is passed trough the view hierarchy on every update and discarded at the end. it's used for animatable views to know if they should animate on this update. It's what withAnimation does, and the animation modifier touches. Now you can add your own data to know if during a body update it was triggered programmatically or by the user for example. A new animation modifier with a closure let's you apply the animation just to specific effects instead of inserting it in the view hierarchy. the other children views are not affected by this animation, unlike the normal animation modifier that injects the animation to all children.

  • transfer velocity auomatically, smooth spring by default
  • sfsymbol animated
  • contentTransition(.numericText(value: totalCaffeine.value))

Observable

macro, so we just need State te and Environment wrappers now.

Scroll effects

scrollTransition to modify the rows when the enter the visible area.

scrollTargetBehaviour(.paging) for full screen paging deceleration

scrollTargetBehaviour(.viewAligned) to decelerate targeting a view, to mark which views are targets use scrollTargetLayout for lazy stacks (important because not all views are created yet, but the stack knows and will tell the scroll) or scrollTarget for the individual views themselves. Can use custom behaviours with ScrollTargetBehaviour conformance.

safeAreaPadding modifier, so the scrollview still extends to the full screen but its views are padded (both your content and its scroll indicators).

contentMargin modifier to specify padding only to the content or to the scroll indicators.

containerRelativeFrame to let the view grow based on the container size. And can use parameters to let multiple views share the space, making grid like layouts.

scrollPosition(id: gives a binding to scroll to that view.

Visual Effects

It gets the content and a geometry proxy.

You can use a coordinate space outside of the view, and compute the distance of a point in the space to the view using the proxy, then use that distance to change the content with effects.

Vertical tabs in watchkit

Menu palette

Picker with the palette style

Performance

Make sure IDs are fast to compute. Just pass to views what they need, otherwise they depend on more. ForEach should just have 1 view so it can match the ID with it. It eagerly gets all IDs, but lazy the views. If there are more views it needs to easily get them too which is bad.

Focus

You can specify the interaction for when a view is focused. (edit or activate) Default focus to specify which element should be focused by default. New onKeyPress modifier. Focus values to tell menu commands which view is in focus. Focus sections to let directional focus (like in tvOS) fall into a non-adjacent view that otherwise wouldn't be elegible for focus.

Widgets

  • Animations and transitions when the data of the widget changes
  • Interactive
    • Can use buttons and toggles with new inits that trigger an app intent.
    • App intent interactions are ensured to trigger a reload immediatly, unlike tmieline changes.
    • Invalidate content modifier for specific views that should show interaction update to the user faster, specially when is on mac since it goes over wifi.
    • Toggle optimistically updates the state so appear faster
    • Widgets show in mac via continuity
    • Widgets for watch stack have design recommendations, instead of hardcoded layouts like in the original apis

CoreData

  • Composite attributes, alternative to transformables
  • Staged schema migrations
  • Deferred migrations, to delay the cleanup of schema migrations (colum or table removals) for later to not block the user.

SwiftData

  • Built on top of proven core data persistance layer (?what does this mean??)
  • Schemas and definitions all in code, with macros. No external schema files.
  • @Model gives you:
    • Persistence
    • Schema modeling
    • Lightweight migration
    • Relationship management
    • iCloud synchronization
    • Spotlight search
    • Undo/Redo
    • @Query to fetch and show results in SwiftUI.
    • Model container understands the relationships of the schema so even if you just give it 1 type it will infer the related types it needs to persist.
    • Advanced model configuration and schema can combine multiple different schemas with different stores into 1.
    • Get the model context trough the environment to operate with the database. It propagates changes to the model container.
    • It uses the undo manager from the environment to automatically support undo/redo.
    • Auto saves in sync with SwiftUI related events and system events. You can also save manually.
    • Fetch trough the context with fetch descriptor and the new predicate macros, which give compiler validated queries.
    • Use the context enumerate method to effeminately fetch lists of data, uses automatically batch processing under the hood, and safe mutation guards. It can be customized.
    • Document based apps by using a SwiftData model as a packaged file
    • But models are still classes... they haven't embraced an immutable model. Pretty weird. :(

CloudKit

CKSyncEngine. Between high level core data integration and low level operations.

TipKit

Looks very interesting, specially with the rules system that will prompt the tips at the appropiate moment and a consistent UI.

Foundation

  • Improvements in gramatical agreement with other arguments and even concepts outside the string.
  • New terms of address for pronouns
  • Resumable upload url session tasks, and support in SwiftNIO

Swift

  • if/switch expressions
  • improved result builders
  • type parameter packs
  • macros
    • native swift foundation
    • ownership
    • c++ interoperatibility
    • discarding task group

Xcode

  • Improved suggestions order
  • New localization strings catalog format
    • Eventually will replace strings and stringdict.
    • Allows variant of strings based on platform (click vs tap)
    • Can make multiple catalogs to have different string tables
    • Xcode automatically extracts localizable strings from code. Use localised initialisers in strings and LocalizedStringResource.
    • In SwiftUI use LocalizedStringResource in your views to accept localizable strings
    • Code gen asset catalog and localisation access
    • Documentation preview in editor assistant
    • Preview macro and UIKit/appkit support
    • Bookmarks
    • Source control improvements
    • test results new design
    • oslog integration in Xcode output, with filters
    • Streamlined workflows for app distribution

UIKit

Custom traits let you bridge with swiftui environment Status bar changes color automatically Page control with progress and timer. Menu palette New text selection style. Comes from free with system text views. Now can also be used in custom text views together with the loupe. New UITextItemTagAttributeName to tag ranges in a text so we can get interactions, ideal for "See More" in text! And it has new APIs to change the default menu behaviour when interacting with them. List and bullets supported in attributed string.

AppKit

  • Table column customizations for free
  • NSProgress support in NSProgressIndicator
  • Popover background can expand to the chevron
  • NSBezier path, CGPath interoperability
  • CADisplayLink!
  • More Sendable everywhere!

App Intents

Improvements on app intents App shortcuts are now discoverable in Spotlight, design for it.

Accessibility

  • isToggle trait
  • AccessibilityNotification.{Anouncement}.post
  • Anouncement priority to avoid interruptions
  • Direct touch options
  • Accessibility shape

App Clips

  • new size limit 50mb for digital invocations
  • Default app clips urls hosted by the app store
  • launching app clips from apps

Privacy

  • new calendar write only permission
  • New embedded photos picker that is smaller, so users picks what they want without requiring to give gallery permissions.
    • Customizable: Hide accessory UI, buttons, specify frame and padding, get selections in real time.
    • Inline style, ideal to combine with hidden accessories.
    • Compact style that is just a row.
    • new macOS window picker to screen recording
    • support for OHTTP relay
    • Communication safety for apps with Sensitive Content Analysis framework to detect nudity. sensitive content warning to blur images.
    • Xcode privacy manifest generates privacy details from third party sdks.
    • Tracking domains help the system block calls to those domains until the user has agreed to be tracked.
    • New Instrument that displays requests to potentially tracking domains
    • Required reason APIs are apis that have potential to be misused for fingerprinting. apps and sdks must declare a reason to use them.
    • Signatures for third party sdks to validate the code comes from the correct authors.

Core Location

New Monitor API based on actors.

Other

  • VisionKit to integrate photo subject lifting into our apps.
  • Accessibility audits now can be automated in UI Tests
  • SFSymbols components to mix in your custom ones.
  • Push Notification Console website
    • Send push to specific device for testing and development
    • Delivery log to know what went wrong. Put device in low power mode to not receive them.
    • Debug tool to validate tokens.
    • Improved App Store Connect APIs and a swift server library
    • DockKit is pretty cool. I didn't know iOS had this functionality out of the box!
    • Keyboard is now out of process.
    • Remember to use the keyboard autolayout guide in UIKit. In SwiftUI the safe area includes the keyboard automatically. If you are still using the old notifications check out the session Keep up with the keyboard because with all the recent keyboard modes it doesn't behave as expected.

If you liked this article please consider supporting me