Skip to content

Commit

Permalink
Fix some sendability errors for Xcodde 16.1 (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrandonw authored Aug 15, 2024
1 parent 93d46bf commit 339ba3e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Sources/SwiftUINavigation/Binding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
/// element is a duplicate of the first.
public func removeDuplicates(
by isDuplicate: @Sendable @escaping (Value, Value) -> Bool
) -> Self {
) -> Self where Value: Sendable {
.init(
get: { self.wrappedValue },
set: { newValue, transaction in
Expand All @@ -73,7 +73,7 @@
}
}

extension Binding where Value: Equatable {
extension Binding where Value: Equatable, Value: Sendable {
/// Creates a binding that ignores writes to its wrapped value when equivalent to the new value.
///
/// Useful to minimize writes to bindings passed to SwiftUI APIs. For example, [`NavigationLink`
Expand All @@ -86,7 +86,7 @@
}
}

extension Binding {
extension Binding where Value: Sendable {
public func _printChanges(_ prefix: String = "") -> Self {
Self(
get: { self.wrappedValue },
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftUINavigation/Internal/Binding+Internal.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#if canImport(SwiftUI)
import SwiftUI

extension Binding {
extension Binding where Value: Sendable {
func didSet(_ perform: @escaping @Sendable (Value) -> Void) -> Self {
.init(
get: { self.wrappedValue },
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftUINavigation/NavigationLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
@available(macOS, introduced: 10.15, deprecated: 13)
@available(tvOS, introduced: 13, deprecated: 16)
@available(watchOS, introduced: 6, deprecated: 9)
public init<Item, WrappedDestination>(
public init<Item: Sendable, WrappedDestination>(
item: Binding<Item?>,
onNavigate: @escaping @Sendable (_ isActive: Bool) -> Void,
@ViewBuilder destination: @escaping (Binding<Item>) -> WrappedDestination,
Expand Down

0 comments on commit 339ba3e

Please sign in to comment.