From c03a3790dce8e3cef716ebb756e87d6bf40615f2 Mon Sep 17 00:00:00 2001 From: Iva Horn Date: Fri, 24 Oct 2025 16:09:28 +0200 Subject: [PATCH] Fix: NextcloudFileProviderKit build with NextcloudKit. NextcloudFileProviderKit was updated to use Swift 6 which imposes some upstream compatibility requirements on NextcloudKit. Signed-off-by: Iva Horn --- Sources/NextcloudKit/NKCommon.swift | 2 +- Sources/NextcloudKit/NKError.swift | 2 +- Sources/NextcloudKit/NKRequestOptions.swift | 2 +- Sources/NextcloudKit/NextcloudKit+Download.swift | 4 ++-- Sources/NextcloudKit/NextcloudKit+WebDAV.swift | 2 +- Sources/NextcloudKit/NextcloudKit.swift | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/NextcloudKit/NKCommon.swift b/Sources/NextcloudKit/NKCommon.swift index 74acbac3..7aea22a9 100644 --- a/Sources/NextcloudKit/NKCommon.swift +++ b/Sources/NextcloudKit/NKCommon.swift @@ -14,7 +14,7 @@ public enum NKTypeReachability: Int, Sendable { } public protocol NextcloudKitDelegate: AnyObject, Sendable { - func authenticationChallenge(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) + func authenticationChallenge(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @Sendable @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) func networkReachabilityObserver(_ typeReachability: NKTypeReachability) diff --git a/Sources/NextcloudKit/NKError.swift b/Sources/NextcloudKit/NKError.swift index 64c17758..9af859ac 100644 --- a/Sources/NextcloudKit/NKError.swift +++ b/Sources/NextcloudKit/NKError.swift @@ -32,7 +32,7 @@ extension OCSPath { static var ocsXMLMsg: Self { ["d:error", "s:message"] } } -public struct NKError: Error, Equatable { +public struct NKError: Error, Equatable, Sendable { static let internalError = -9999 public let errorCode: Int public let errorDescription: String diff --git a/Sources/NextcloudKit/NKRequestOptions.swift b/Sources/NextcloudKit/NKRequestOptions.swift index 11406a27..f2b6741c 100644 --- a/Sources/NextcloudKit/NKRequestOptions.swift +++ b/Sources/NextcloudKit/NKRequestOptions.swift @@ -5,7 +5,7 @@ import Foundation -public class NKRequestOptions: NSObject { +final public class NKRequestOptions: NSObject, Sendable { public let endpoint: String? public let version: String? internal(set) public var customHeader: [String: String]? diff --git a/Sources/NextcloudKit/NextcloudKit+Download.swift b/Sources/NextcloudKit/NextcloudKit+Download.swift index 9679b06f..13f03ecd 100644 --- a/Sources/NextcloudKit/NextcloudKit+Download.swift +++ b/Sources/NextcloudKit/NextcloudKit+Download.swift @@ -26,7 +26,7 @@ public extension NextcloudKit { requestHandler: @escaping (_ request: DownloadRequest) -> Void = { _ in }, taskHandler: @escaping (_ task: URLSessionTask) -> Void = { _ in }, progressHandler: @escaping (_ progress: Progress) -> Void = { _ in }, - completionHandler: @escaping (_ account: String, _ etag: String?, _ date: Date?, _ lenght: Int64, _ headers: [AnyHashable: Any]?, _ afError: AFError?, _ nKError: NKError) -> Void) { + completionHandler: @escaping (_ account: String, _ etag: String?, _ date: Date?, _ lenght: Int64, _ headers: [AnyHashable: any Sendable]?, _ afError: AFError?, _ nKError: NKError) -> Void) { var convertible: URLConvertible? if serverUrlFileName is URL { convertible = serverUrlFileName as? URLConvertible @@ -103,7 +103,7 @@ public extension NextcloudKit { etag: String?, date: Date?, length: Int64, - headers: [AnyHashable: Any]?, + headers: [AnyHashable: any Sendable]?, afError: AFError?, nkError: NKError ) { diff --git a/Sources/NextcloudKit/NextcloudKit+WebDAV.swift b/Sources/NextcloudKit/NextcloudKit+WebDAV.swift index f10e3f9e..ca43cdc6 100644 --- a/Sources/NextcloudKit/NextcloudKit+WebDAV.swift +++ b/Sources/NextcloudKit/NextcloudKit+WebDAV.swift @@ -1193,7 +1193,7 @@ public extension NextcloudKit { showHiddenFiles: Bool, account: String, options: NKRequestOptions = NKRequestOptions(), - taskHandler: @escaping (_ task: URLSessionTask) -> Void = { _ in } + taskHandler: @Sendable @escaping (_ task: URLSessionTask) -> Void = { _ in } ) async -> ( account: String, items: [NKTrash]?, diff --git a/Sources/NextcloudKit/NextcloudKit.swift b/Sources/NextcloudKit/NextcloudKit.swift index ae7d63c2..cd2c107d 100644 --- a/Sources/NextcloudKit/NextcloudKit.swift +++ b/Sources/NextcloudKit/NextcloudKit.swift @@ -10,7 +10,7 @@ import UIKit import Alamofire import SwiftyJSON -open class NextcloudKit { +open class NextcloudKit: @unchecked Sendable { #if swift(<6.0) public static let shared: NextcloudKit = { let instance = NextcloudKit()