Skip to content

Commit 20b5165

Browse files
committed
Migrate to Swift 6 & add any missing Sendable conformances
1 parent 7b7fbf5 commit 20b5165

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.9
1+
// swift-tools-version: 6.0
22
import PackageDescription
33

44
let package = Package(

Sources/HandySwift/Globals.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Foundation
66
/// - timeInterval: The duration of the delay. E.g., `.seconds(1)` or `.milliseconds(200)`.
77
/// - qosClass: The global QoS class to be used or `nil` to use the main thread. Defaults to `nil`.
88
/// - closure: The code to run with a delay.
9-
public func delay(by timeInterval: TimeInterval, qosClass: DispatchQoS.QoSClass? = nil, _ closure: @escaping () -> Void) {
9+
public func delay(by timeInterval: TimeInterval, qosClass: DispatchQoS.QoSClass? = nil, _ closure: @Sendable @escaping () -> Void) {
1010
let dispatchQueue = qosClass != nil ? DispatchQueue.global(qos: qosClass!) : DispatchQueue.main
1111
dispatchQueue.asyncAfter(deadline: DispatchTime.now() + timeInterval, execute: closure)
1212
}
@@ -19,7 +19,7 @@ public func delay(by timeInterval: TimeInterval, qosClass: DispatchQoS.QoSClass?
1919
/// - closure: The code to run with a delay.
2020
@_disfavoredOverload
2121
@available(iOS 16, macOS 13, tvOS 16, visionOS 1, watchOS 9, *)
22-
public func delay(by duration: Duration, qosClass: DispatchQoS.QoSClass? = nil, _ closure: @escaping () -> Void) {
22+
public func delay(by duration: Duration, qosClass: DispatchQoS.QoSClass? = nil, _ closure: @Sendable @escaping () -> Void) {
2323
let dispatchQueue = qosClass != nil ? DispatchQueue.global(qos: qosClass!) : DispatchQueue.main
2424
dispatchQueue.asyncAfter(deadline: DispatchTime.now() + duration.timeInterval, execute: closure)
2525
}

Sources/HandySwift/Types/Debouncer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public final class Debouncer {
5252
/// }
5353
/// ```
5454
@available(iOS 16, macOS 13, tvOS 16, visionOS 1, watchOS 9, *)
55-
public func delay(for duration: Duration, id: String = "default", operation: @escaping () -> Void) {
55+
public func delay(for duration: Duration, id: String = "default", operation: @Sendable @escaping () -> Void) {
5656
self.cancel(id: id)
5757
self.timerByID[id] = Timer.scheduledTimer(withTimeInterval: duration.timeInterval, repeats: false) { _ in
5858
operation()
@@ -76,7 +76,7 @@ public final class Debouncer {
7676
/// performOperation()
7777
/// }
7878
/// ```
79-
public func delay(for interval: TimeInterval, id: String = "default", operation: @escaping () -> Void) {
79+
public func delay(for interval: TimeInterval, id: String = "default", operation: @Sendable @escaping () -> Void) {
8080
self.cancel(id: id)
8181
self.timerByID[id] = Timer.scheduledTimer(withTimeInterval: interval, repeats: false) { _ in
8282
operation()

Sources/HandySwift/Types/HandyRegex.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ extension HandyRegex: Hashable {
206206

207207
extension HandyRegex {
208208
/// `Options` defines alternate behaviours of regular expressions when matching.
209-
public struct Options: OptionSet {
209+
public struct Options: OptionSet, Sendable {
210210
/// Ignores the case of letters when matching.
211211
public static let ignoreCase = Options(rawValue: 1)
212212

0 commit comments

Comments
 (0)