diff --git a/Package@swift-5.9.swift b/Package@swift-5.9.swift new file mode 100644 index 0000000000..23ac97bb79 --- /dev/null +++ b/Package@swift-5.9.swift @@ -0,0 +1,63 @@ +// swift-tools-version:5.9 + +import PackageDescription + +let package = Package( + name: "swiftui-navigation", + platforms: [ + .iOS(.v13), + .macOS(.v10_15), + .tvOS(.v13), + .watchOS(.v6), + ], + products: [ + .library( + name: "SwiftUINavigation", + targets: ["SwiftUINavigation"] + ), + .library( + name: "SwiftUINavigationCore", + targets: ["SwiftUINavigationCore"] + ), + ], + dependencies: [ + .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"), + .package(url: "https://github.com/pointfreeco/swift-case-paths", from: "1.2.2"), + .package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.0.0"), + .package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.0.0"), + ], + targets: [ + .target( + name: "SwiftUINavigation", + dependencies: [ + "SwiftUINavigationCore", + .product(name: "CasePaths", package: "swift-case-paths"), + ] + ), + .testTarget( + name: "SwiftUINavigationTests", + dependencies: [ + "SwiftUINavigation" + ] + ), + .target( + name: "SwiftUINavigationCore", + dependencies: [ + .product(name: "CustomDump", package: "swift-custom-dump"), + .product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"), + ] + ), + ] +) + +for target in package.targets { + target.swiftSettings = target.swiftSettings ?? [] + target.swiftSettings!.append(contentsOf: [ + .enableExperimentalFeature("StrictConcurrency") + ]) + // target.swiftSettings?.append( + // .unsafeFlags([ + // "-enable-library-evolution", + // ]) + // ) +} diff --git a/Sources/SwiftUINavigation/Alert.swift b/Sources/SwiftUINavigation/Alert.swift index cfe8fced57..6cd7524cb6 100644 --- a/Sources/SwiftUINavigation/Alert.swift +++ b/Sources/SwiftUINavigation/Alert.swift @@ -46,9 +46,9 @@ /// dismisses the alert, and the action is fed to the `action` closure. /// - handler: A closure that is called with an action from a particular alert button when /// tapped. - public func alert( + public func alert( _ state: Binding?>, - action handler: @escaping (Value?) async -> Void = { (_: Never?) async in } + action handler: @escaping @Sendable (Value?) async -> Void = { (_: Never?) async in } ) -> some View { alert(item: state) { Text($0.title) diff --git a/Sources/SwiftUINavigation/ConfirmationDialog.swift b/Sources/SwiftUINavigation/ConfirmationDialog.swift index eae1840819..89d5b1a14d 100644 --- a/Sources/SwiftUINavigation/ConfirmationDialog.swift +++ b/Sources/SwiftUINavigation/ConfirmationDialog.swift @@ -49,9 +49,9 @@ /// - handler: A closure that is called with an action from a particular dialog button when /// tapped. @available(iOS 15, macOS 12, tvOS 15, watchOS 8, *) - public func confirmationDialog( + public func confirmationDialog( _ state: Binding?>, - action handler: @escaping (Value?) async -> Void = { (_: Never?) async in } + action handler: @escaping @Sendable (Value?) async -> Void = { (_: Never?) async in } ) -> some View { confirmationDialog( item: state, diff --git a/Sources/SwiftUINavigationCore/AlertState.swift b/Sources/SwiftUINavigationCore/AlertState.swift index aff3f6ed53..30506c023a 100644 --- a/Sources/SwiftUINavigationCore/AlertState.swift +++ b/Sources/SwiftUINavigationCore/AlertState.swift @@ -249,7 +249,10 @@ /// - state: Alert state used to populate the alert. /// - action: An action handler, called when a button with an action is tapped, by passing the /// action to the closure. - public init(_ state: AlertState, action: @escaping (Action?) async -> Void) { + public init( + _ state: AlertState, + action: @escaping @Sendable (Action?) async -> Void + ) { if state.buttons.count == 2 { self.init( title: Text(state.title), diff --git a/Sources/SwiftUINavigationCore/ButtonState.swift b/Sources/SwiftUINavigationCore/ButtonState.swift index 91f062a7ea..efe8acbcf2 100644 --- a/Sources/SwiftUINavigationCore/ButtonState.swift +++ b/Sources/SwiftUINavigationCore/ButtonState.swift @@ -260,7 +260,10 @@ /// - Parameters: /// - button: Button state. /// - action: An action closure that is invoked when the button is tapped. - public init(_ button: ButtonState, action: @escaping (Action?) async -> Void) { + public init( + _ button: ButtonState, + action: @escaping @Sendable (Action?) async -> Void + ) { let action = { _ = Task { await button.withAction(action) } } switch button.role { case .cancel: @@ -310,7 +313,10 @@ /// - button: Button state. /// - action: An action closure that is invoked when the button is tapped. @available(iOS 15, macOS 12, tvOS 15, watchOS 8, *) - public init(_ button: ButtonState, action: @escaping (Action?) async -> Void) { + public init( + _ button: ButtonState, + action: @escaping @Sendable (Action?) async -> Void + ) { self.init( role: button.role.map(ButtonRole.init), action: { Task { await button.withAction(action) } }