It is ridiculous to use two different versions of Concurrency API for different platforms.
Xcode 13 beta 2 (13A5155e) uses two different versions of Concurrency for iOS and other platforms (e.g. macOS, watchOS, tvOS)!
//
// TestAsyncApp.swift
// Shared
//
//
import SwiftUI
@main
struct TestAsyncApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
@available(iOS 15.0, macOS 12.0, watchOS 8.0, tvOS 15.0, *)
func testAsync() {
#if os(macOS) || os(watchOS) || os(tvOS)
// will trigger error for iOS
Task {
}
Task.detach {
}
#elseif os(iOS)
// will trigger deprecated warning for macOS, watchOS and tvOS
async {
}
asyncDetached {
}
#endif
}
}