diff --git a/.swiftpm/configuration/Package.resolved b/.swiftpm/configuration/Package.resolved new file mode 100644 index 00000000..023d6322 --- /dev/null +++ b/.swiftpm/configuration/Package.resolved @@ -0,0 +1,23 @@ +{ + "pins" : [ + { + "identity" : "swift-docc-plugin", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-docc-plugin", + "state" : { + "revision" : "2eb22993b3dfd0c0d32729b357c8dabb6cd44680", + "version" : "1.4.2" + } + }, + { + "identity" : "swift-docc-symbolkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swiftlang/swift-docc-symbolkit", + "state" : { + "revision" : "b45d1f2ed151d057b54504d653e0da5552844e34", + "version" : "1.0.0" + } + } + ], + "version" : 2 +} diff --git a/Package.swift b/Package.swift index 871d5861..43b0a8aa 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.9 +// swift-tools-version:6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/Sources/MusadoraKit/Requests/MDataRequest.swift b/Sources/MusadoraKit/Requests/MDataRequest.swift index 5063024f..455ac1e7 100644 --- a/Sources/MusadoraKit/Requests/MDataRequest.swift +++ b/Sources/MusadoraKit/Requests/MDataRequest.swift @@ -6,6 +6,7 @@ // import Foundation +@preconcurrency import MusicKit /// A request structure for fetching data from an arbitrary Apple Music API endpoint. /// @@ -37,7 +38,7 @@ public struct MDataRequest { /// The URL request used to specify details for the API call, such as endpoint, method, and headers. public let urlRequest: URLRequest - + /// Initializes a new data request using the specified URL request and developer token. /// /// - Parameters: @@ -55,9 +56,11 @@ public struct MDataRequest { /// - Returns: A `MusicDataResponse` object containing the outcome of the API call. /// - Throws: An error if there's a problem initiating or receiving the response. public func response() async throws -> MusicDataResponse { - MusicDataRequest.tokenProvider = MDeveloperTokenProvider(developerToken: developerToken) + let token = self.developerToken + MusicDataRequest.tokenProvider = await MDeveloperTokenProvider(developerToken: token) let request = MusicDataRequest(urlRequest: urlRequest) let response = try await request.response() return response } } + diff --git a/Sources/MusadoraKit/Requests/MDeveloperTokenProvider.swift b/Sources/MusadoraKit/Requests/MDeveloperTokenProvider.swift index 745c63b6..a850a1b1 100644 --- a/Sources/MusadoraKit/Requests/MDeveloperTokenProvider.swift +++ b/Sources/MusadoraKit/Requests/MDeveloperTokenProvider.swift @@ -27,7 +27,8 @@ import Foundation /// // Now proceed with sending a MusicDataRequest /// ``` /// -public class MDeveloperTokenProvider: MusicTokenProvider, @unchecked Sendable { +@MainActor +final public class MDeveloperTokenProvider: MusicTokenProvider, Sendable { /// The **custom** developer token used to authenticate Apple Music API requests. private var developerToken: String = "" diff --git a/Sources/MusadoraKit/Requests/MUserRequest.swift b/Sources/MusadoraKit/Requests/MUserRequest.swift index af80a4b7..354e202b 100644 --- a/Sources/MusadoraKit/Requests/MUserRequest.swift +++ b/Sources/MusadoraKit/Requests/MUserRequest.swift @@ -6,6 +6,7 @@ // import Foundation +@preconcurrency import MusicKit /// A request structure for fetching data from an arbitrary Apple Music API endpoint requiring user authentication. ///