Warnings in SwiftUI's own code with strict concurrency checking on

I've enabled Swift's strict concurrency checking (SWIFT_STRICT_CONCURRENCY = complete) on one of my projects and am now getting these warnings:

SwiftUI.PreviewProvider:4:34: warning: main actor-isolated static property '_previews' cannot be used to satisfy nonisolated protocol requirement
    @MainActor public static var _previews: Any { get }
                                 ^
SwiftUI._PreviewProvider:3:16: note: '_previews' declared here
    static var _previews: Any { get }
               ^
SwiftUI.PreviewProvider:5:34: warning: main actor-isolated static property '_platform' cannot be used to satisfy nonisolated protocol requirement
    @MainActor public static var _platform: PreviewPlatform? { get }
                                 ^
SwiftUI._PreviewProvider:4:16: note: '_platform' declared here
    static var _platform: PreviewPlatform? { get }
               ^

Is this an omission on SwiftUI's part, or can it be somehow fixed in my code? (I have a zero warnings policy in all my projects so would like to know what to do with this.)

P.S. I'm targeting iOS 16.

1 Like

Can you share parts of your type and protocols. It's hard to tell just from the bare warnings.

I see these too, seems like an issue within SwiftUI itself. The use of _platform is either an explicit internal property or a property wrapper around an internal platform variable, as even Sendable wrappers don't properly convey that conformance to the generated properties.

Those are properties in SwiftUI's own PreviewProvider interface.

1 Like

Does @preconcurrency import potentially help there?

I just tried and nope, it doesn't.