diff --git a/Package.swift b/Package.swift index 2c689cf..c96e65f 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.9 +// swift-tools-version: 6.0 import PackageDescription let package = Package( diff --git a/Sources/HandySwift/Globals.swift b/Sources/HandySwift/Globals.swift index 6d90289..2746324 100644 --- a/Sources/HandySwift/Globals.swift +++ b/Sources/HandySwift/Globals.swift @@ -6,7 +6,7 @@ import Foundation /// - timeInterval: The duration of the delay. E.g., `.seconds(1)` or `.milliseconds(200)`. /// - qosClass: The global QoS class to be used or `nil` to use the main thread. Defaults to `nil`. /// - closure: The code to run with a delay. -public func delay(by timeInterval: TimeInterval, qosClass: DispatchQoS.QoSClass? = nil, _ closure: @escaping () -> Void) { +public func delay(by timeInterval: TimeInterval, qosClass: DispatchQoS.QoSClass? = nil, _ closure: @Sendable @escaping () -> Void) { let dispatchQueue = qosClass != nil ? DispatchQueue.global(qos: qosClass!) : DispatchQueue.main dispatchQueue.asyncAfter(deadline: DispatchTime.now() + timeInterval, execute: closure) } @@ -19,7 +19,7 @@ public func delay(by timeInterval: TimeInterval, qosClass: DispatchQoS.QoSClass? /// - closure: The code to run with a delay. @_disfavoredOverload @available(iOS 16, macOS 13, tvOS 16, visionOS 1, watchOS 9, *) -public func delay(by duration: Duration, qosClass: DispatchQoS.QoSClass? = nil, _ closure: @escaping () -> Void) { +public func delay(by duration: Duration, qosClass: DispatchQoS.QoSClass? = nil, _ closure: @Sendable @escaping () -> Void) { let dispatchQueue = qosClass != nil ? DispatchQueue.global(qos: qosClass!) : DispatchQueue.main dispatchQueue.asyncAfter(deadline: DispatchTime.now() + duration.timeInterval, execute: closure) } diff --git a/Sources/HandySwift/Types/Debouncer.swift b/Sources/HandySwift/Types/Debouncer.swift index c9184d9..db0383a 100644 --- a/Sources/HandySwift/Types/Debouncer.swift +++ b/Sources/HandySwift/Types/Debouncer.swift @@ -52,7 +52,7 @@ public final class Debouncer { /// } /// ``` @available(iOS 16, macOS 13, tvOS 16, visionOS 1, watchOS 9, *) - public func delay(for duration: Duration, id: String = "default", operation: @escaping () -> Void) { + public func delay(for duration: Duration, id: String = "default", operation: @Sendable @escaping () -> Void) { self.cancel(id: id) self.timerByID[id] = Timer.scheduledTimer(withTimeInterval: duration.timeInterval, repeats: false) { _ in operation() @@ -76,7 +76,7 @@ public final class Debouncer { /// performOperation() /// } /// ``` - public func delay(for interval: TimeInterval, id: String = "default", operation: @escaping () -> Void) { + public func delay(for interval: TimeInterval, id: String = "default", operation: @Sendable @escaping () -> Void) { self.cancel(id: id) self.timerByID[id] = Timer.scheduledTimer(withTimeInterval: interval, repeats: false) { _ in operation() diff --git a/Sources/HandySwift/Types/HandyRegex.swift b/Sources/HandySwift/Types/HandyRegex.swift index ca31a7a..28ae3ab 100644 --- a/Sources/HandySwift/Types/HandyRegex.swift +++ b/Sources/HandySwift/Types/HandyRegex.swift @@ -206,7 +206,7 @@ extension HandyRegex: Hashable { extension HandyRegex { /// `Options` defines alternate behaviours of regular expressions when matching. - public struct Options: OptionSet { + public struct Options: OptionSet, Sendable { /// Ignores the case of letters when matching. public static let ignoreCase = Options(rawValue: 1)