Like the post of last year on WWDC20, I write notes on the videos I watch about WWDC21.

Keynote

  • No technical notes here

Platforms State of the Union

Xcode Cloud

  • 2:47 - CI/CD service built into Xcode and hosted in the cloud. Designed to support all Apple platforms. Extensible with REST APIs. You create and manage Xcode Cloud workflows inside Xcode 13, while test suits, code signing and TestFlight distribution are handled for you. When Xcode Cloud finishes a build, the results are inside Xcode.
  • 6:50 - You can choose for each workflow the versions of Xcode and MacOS used for the compilation. It's also possible to use the Beta versions.
  • 7:50 - Workflow management and Build reports are also available in AppStore Connect on the web.
  • 8:15 - With Xcode Cloud it's possible to configure the workflows to run multiple test plans across multiple platforms, device simulators and OS versions all in parallel (including beta versions).
  • 11.40 - Xcode 13 bring discussions with the team directly inside the editor. It requires the users to be logged in.
  • 14.10 - Code Signing in the Cloud doesn't required to have certificates and profiles up to date on the development machine. You can use now the Archive action to sign for distribution. Now TestFlight is available also for Mac.
  • 14.45 - In iOS 13 there are better tools to connect you to the same diagnostics and feedback found in App Store Connect. Crash Logs from TestFlight apps are delivered to the Organizer within minutes.

Swift Concurrency

  • 21:30 - Now it's possible to make an asynchronous function with async and when you call it, you use await. For example:
    func prepareForShow() async throws -> Scene {
       let dancers = try await danceCompany.warmUp(duration: .minutes(45))
       let scenery = await crew.fetchStageScenery()
       let openingScene = setStage(with: scenery)
       return try await dancers.moveToPosition(in: openingScene)
    }
    
    and you can use the usual Swift constructs, for example:
    func prepareForShow(isStudioRehearsal: Bool) async throws -> Scene {
       let dancers = try await danceCompany.warmUp(duration: .minutes(45))
       let scenery = isStudioRehearsal ? await crew.fetchPracticeScenery() : await crew.fetchStageScenery()
       let openingScene = setStage(with: scenery)
       return try await dancers.moveToPosition(in: openingScene)
    }
    
  • 23:05 - Structure Concurrency is a way to organize concurrent tasks. In the previous example, you might want to execute the first two tasks in parallel:
    func prepareForShow() async throws -> Scene {
       async let dancers = danceCompany.warmUp(duration: .minutes(45))
       async let scenery = crew.fetchStageScenery()
       let openingScene = setStage(with: await scenery)
       return try await dancers.moveToPosition(in: openingScene)
    }
    
    async let variables create child tasks that execute concurrently with the parent. When we need the results of those child tasks, we await the results.
  • 24:36 - Actors are a model for safe concurrent programming and a synchronization primitive. An actor is an object that protects its state providing mutually exclusive access.
    actor StageManager {
       var stage: Stage
       
       func setStage(with scenery: Scenery) -> Scene {
          stage.backdrop = scenery.backdrop
          for prop in scenery.props {
             stage.addProp(prop)
          }
          return stage.currentScene
       }
    }
    
    An actor can access its own properties directly, but interacting with an actor externally uses async/await to guarantee mutual exclusion:
    let scene = await stageManager.setStage(with: scenery)
    
  • 26:10 - Actors solve the problem of using the main thread for UI operations. Now it's possible to declare that an operation must be run on the main thread using @MainActor:
    @MainActor
    func display(scene: Scene)
    
    await display(scene: scene)
    

SwiftUI

  • 30:20 - List supports now:
    • swipe to refresh with .refreshable,
    • search field with .searchable,
    • accessibility support with .accessibilityRotor.
  • 31:50 - Multi-table support for Mac with Table and TableColumn.
  • 33:00 - Possibility to add background images to controls, that automatically fades it and adjusts colors to keep the content above it readable.
  • 33:50 - App development with SwiftUI to iPad in Swift Playgrounds 4.

Augmented Reality

  • 40:25 - RealityKit 2 is an update that gives more visual, audio and animation control.
  • 40:45 - With Object Capture it's possible now to create 3D models with iPhone pictures. It generates USDZ files, but also USD and OBJ asset bundles.
  • 45:40 - With the M1 chip, Apple has created a unified Apple graphics platform with a common architecture based on Metal, the Apple GPU and unified memory.

Notifications

  • 51:55 - With the new Interruption Level API, notifications can now provide different levels of urgency. Notification can be assigned to four different levels:
    • passive interruptions: are silent and don't wake up the device;
    • active interruptions: will play a sound or haptic, like notifications today;
    • time sensitive interruptions: are designed to visually stand out and hang on the lock screen a little longer; they will also be announced by Siri, if the user is wearing AirPods;
    • critical alerts: are the most urgent category, they will play a sound even if the device is muted; they required an approved entitlement;
    • communications: they are displayed in a different way, with an avatar the app icon superimposed.
  • 55:30 - Do Not Disturb silences all notifications; with Focus, users can choose apps and people who can send them notifications.

Widgets

  • 1:03:25 - Widgets are now possible on the iPad home screen, and now it's possible to have new extra-large widgets.

SharePlay

  • 1:06:40 - SharePlay allows to define activities with the new Group Activity framework, that can be shared through FaceTime and iMessage.
  • 1:10:00 - it's also possible to share not only audio and video, but also data.