Skip to content

Commit

Permalink
Update for Swift 6
Browse files Browse the repository at this point in the history
  • Loading branch information
rudrankriyam committed Sep 4, 2024
1 parent 2a476cc commit c5d4139
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .swiftpm/configuration/Package.resolved
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 5 additions & 2 deletions Sources/MusadoraKit/Requests/MDataRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
@preconcurrency import MusicKit

/// A request structure for fetching data from an arbitrary Apple Music API endpoint.
///
Expand Down Expand Up @@ -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:
Expand All @@ -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
}
}

3 changes: 2 additions & 1 deletion Sources/MusadoraKit/Requests/MDeveloperTokenProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
1 change: 1 addition & 0 deletions Sources/MusadoraKit/Requests/MUserRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down

0 comments on commit c5d4139

Please sign in to comment.