From bcd7b096d824d28804006a9fb958d5652a3a609d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sylvain=20Fay-ch=C3=A2telard?= Date: Fri, 20 Sep 2024 11:51:24 +0200 Subject: [PATCH] Add Swift safety --- Package.swift | 13 +++++++++++-- .../Client/OCDirectionsAPIClient.h | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Package.swift b/Package.swift index 04468d7..837fbf4 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.1 +// swift-tools-version:6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -21,9 +21,18 @@ let package = Package( .target( name: "OCGoogleDirectionsAPI", dependencies: [], - publicHeadersPath: "."), + publicHeadersPath: ".", + swiftSettings: .completeConcurrencyChecking), .testTarget( name: "OCGoogleDirectionsAPITests", dependencies: ["OCGoogleDirectionsAPI"]), ] ) + +extension Array where Element == SwiftSetting { + static let completeConcurrencyChecking: Self = [.completeConcurrencyChecking] +} + +extension SwiftSetting { + static let completeConcurrencyChecking = Self.unsafeFlags(["-strict-concurrency=complete"]) +} diff --git a/Sources/OCGoogleDirectionsAPI/Client/OCDirectionsAPIClient.h b/Sources/OCGoogleDirectionsAPI/Client/OCDirectionsAPIClient.h index e3ddeb3..5dd4f3e 100644 --- a/Sources/OCGoogleDirectionsAPI/Client/OCDirectionsAPIClient.h +++ b/Sources/OCGoogleDirectionsAPI/Client/OCDirectionsAPIClient.h @@ -12,7 +12,7 @@ #import "RequestURLCreator/OCDirectionsRequestURLCreator.h" #import "RequestURLCreator/OCDirectionsRequestURLCreatorJSON.h" -typedef void (^OCDirectionsRequestCallback)(OCDirectionsResponse *response, NSError *error); +typedef NS_SWIFT_UI_ACTOR NS_SWIFT_SENDABLE void (^OCDirectionsRequestCallback)(OCDirectionsResponse *response, NSError *error); @interface OCDirectionsAPIClient : NSObject