Swift 5.10 Concurrency and XCTest

Do you know if we should we be filing Feedbacks for APIs which aren't playing nicely with Swift Concurrency at this stage?

For example, in SwiftUI:

import StoreKit

/* @MainActor */ // occurs with or without annotation 
struct MyView: View {
  // Cannot form key path to main actor-isolated property 'requestReview'; this is an error in Swift 6
  @Environment(\.requestReview) private var requestReview

  var body: some View {
    Text("Cannot form key path to main actor-isolated property")
  }
}

Or os:

/* @preconcurrency doesn't help */ import os

enum Log {
  // Static property 'shared' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6
  static let shared = Logger(subsystem: "logging", category: "warnings")
}

Or Foundation:

import Foundation

public final class UnitWarning: Dimension {
  
  public override class func baseUnit() -> UnitWarning { .warnings }
  
  // Static property 'warnings' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6
  public static let warnings = UnitWarning(
    symbol: "WARN",
    converter: UnitConverterLinear(coefficient: 1)
  )
}

(This can be 'fixed' by turning it into a computed property but that would be pretty terrible for performance.)

1 Like