From 4111c5b0c9cf7df216443689d40ccbe8e9cab715 Mon Sep 17 00:00:00 2001 From: Alexander Eichhorn Date: Tue, 22 Oct 2024 00:49:19 +0200 Subject: [PATCH] old Swift version tests (#57) --- .github/workflows/swift.yml | 9 ++++++++- Package.swift | 2 +- Sources/YouTubeKit/Extensions/URLSessionDelegates.swift | 4 ++++ Sources/YouTubeKit/YouTube.swift | 5 +++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 552cdd5..7542567 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -4,10 +4,17 @@ on: push jobs: build: - + + strategy: + matrix: + swift: ["5.9", "5.10"] + runs-on: macos-latest steps: + - uses: swift-actions/setup-swift@v2 + with: + swift-version: ${{ matrix.swift }} - uses: actions/checkout@v2 - name: Build run: swift build -v diff --git a/Package.swift b/Package.swift index 93297b1..4945932 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.5 +// swift-tools-version:5.8 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/Sources/YouTubeKit/Extensions/URLSessionDelegates.swift b/Sources/YouTubeKit/Extensions/URLSessionDelegates.swift index 2cc1fcf..9e7183e 100644 --- a/Sources/YouTubeKit/Extensions/URLSessionDelegates.swift +++ b/Sources/YouTubeKit/Extensions/URLSessionDelegates.swift @@ -13,7 +13,11 @@ final class ConfigurableURLSessionDelegate: NSObject, URLSessionTaskDelegate { let applyCookiesOnRedirect: Bool let saveIntermediateResponses: Bool +#if swift(>=5.10) nonisolated(unsafe) var intermediateResponses = [HTTPURLResponse]() +#else + var intermediateResponses = [HTTPURLResponse]() +#endif init(allowsRedirect: Bool, applyCookiesOnRedirect: Bool, saveIntermediateResponses: Bool) { self.allowsRedirects = allowsRedirect diff --git a/Sources/YouTubeKit/YouTube.swift b/Sources/YouTubeKit/YouTube.swift index 6f65de6..9f8e020 100644 --- a/Sources/YouTubeKit/YouTube.swift +++ b/Sources/YouTubeKit/YouTube.swift @@ -14,8 +14,13 @@ public class YouTube { private var _js: String? private var _jsURL: URL? +#if swift(>=5.10) nonisolated(unsafe) private static var __js: String? // caches js between calls nonisolated(unsafe) private static var __jsURL: URL? +#else + private static var __js: String? // caches js between calls + private static var __jsURL: URL? +#endif private var _videoInfos: [InnerTube.VideoInfo]?