Skip to content

Commit

Permalink
old Swift version tests (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeichhorn authored Oct 21, 2024
1 parent b6f2253 commit 4111c5b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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.5
// swift-tools-version:5.8
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down
4 changes: 4 additions & 0 deletions Sources/YouTubeKit/Extensions/URLSessionDelegates.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Sources/YouTubeKit/YouTube.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]?

Expand Down

0 comments on commit 4111c5b

Please sign in to comment.