diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 4e88c737..48d56585 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -8,7 +8,7 @@ on: branches: [ tretnfckit-main ] env: - XCODE_SELECT_PATH: '/Applications/Xcode_14.3.app/Contents/Developer' + XCODE_SELECT_PATH: '/Applications/Xcode_15.2.app/Contents/Developer' jobs: show_software_information: @@ -19,7 +19,7 @@ jobs: os: [macos-13, ubuntu-20.04, ubuntu-22.04] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Show Swift version run: swift --version - name: Show Swift Package Manager version @@ -33,7 +33,7 @@ jobs: os: [macos-13, ubuntu-20.04, ubuntu-22.04] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set Xcode version if: matrix.os == 'macos-13' run: sudo xcode-select -s '${{ env.XCODE_SELECT_PATH }}' @@ -41,7 +41,7 @@ jobs: run: swift build -v | tee swift-build_${{ matrix.os }}.log && exit ${PIPESTATUS[0]} - name: Upload build log if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: swift build log (${{ matrix.os }}) path: | @@ -50,7 +50,7 @@ jobs: run: swift test -v | tee swift-test_${{ matrix.os }}.log && exit ${PIPESTATUS[0]} - name: Upload test log if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: swift test log (${{ matrix.os }}) path: | diff --git a/.github/workflows/xcodebuild.yml b/.github/workflows/xcodebuild.yml index 49967953..4301ed33 100644 --- a/.github/workflows/xcodebuild.yml +++ b/.github/workflows/xcodebuild.yml @@ -9,10 +9,11 @@ on: env: SCHEME_NAME: TRETNFCKit-Package - IOS_SIMULATOR_NAME: iPhone 14 Pro - TVOS_SIMULATOR_NAME: Apple TV 4K (2nd generation) - WATCHOS_SIMULATOR_NAME: Apple Watch Ultra (49mm) - XCODE_SELECT_PATH: '/Applications/Xcode_14.3.app/Contents/Developer' + IOS_SIMULATOR_NAME: iPhone 15 Pro + TVOS_SIMULATOR_NAME: Apple TV 4K (3rd generation) + WATCHOS_SIMULATOR_NAME: Apple Watch Ultra 2 (49mm) + VISIONOS_SIMULATOR_NAME: Apple Vision Pro + XCODE_SELECT_PATH: '/Applications/Xcode_15.2.app/Contents/Developer' jobs: show_software_information: @@ -23,7 +24,7 @@ jobs: os: [macos-13] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Show Xcode list run: ls -n /Applications | grep 'Xcode' - name: Show the default version of Xcode @@ -41,10 +42,10 @@ jobs: fail-fast: false matrix: os: [macos-13] - platform: ['iOS', 'macOS', 'macCatalyst', 'tvOS', 'watchOS'] + platform: ['iOS', 'macOS', 'macCatalyst', 'tvOS', 'watchOS', 'visionOS'] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set Xcode version run: sudo xcode-select -s '${{ env.XCODE_SELECT_PATH }}' - name: Build the scheme @@ -55,10 +56,11 @@ jobs: 'macCatalyst' ) xcodebuild -scheme ${{ env.SCHEME_NAME }} -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' | tee xcodebuild-${{ matrix.platform }}.log && exit ${PIPESTATUS[0]} ;; 'tvOS' ) xcodebuild -scheme ${{ env.SCHEME_NAME }} -destination 'name=${{ env.TVOS_SIMULATOR_NAME }}' | tee xcodebuild-${{ matrix.platform }}.log && exit ${PIPESTATUS[0]} ;; 'watchOS' ) xcodebuild -scheme ${{ env.SCHEME_NAME }} -destination 'name=${{ env.WATCHOS_SIMULATOR_NAME }}' | tee xcodebuild-${{ matrix.platform }}.log && exit ${PIPESTATUS[0]} ;; + 'visionOS' ) xcodebuild -scheme ${{ env.SCHEME_NAME }} -destination 'name=${{ env.VISIONOS_SIMULATOR_NAME }}' | tee xcodebuild-${{ matrix.platform }}.log && exit ${PIPESTATUS[0]} ;; esac - name: Upload Xcode Build log if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: xcodebuild log (${{ matrix.platform }}) path: | @@ -71,6 +73,7 @@ jobs: 'macCatalyst' ) xcodebuild test -scheme ${{ env.SCHEME_NAME }} -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -resultBundlePath TestResults-${{ matrix.platform }} ;; 'tvOS' ) xcodebuild test -scheme ${{ env.SCHEME_NAME }} -destination 'name=${{ env.TVOS_SIMULATOR_NAME }}' -resultBundlePath TestResults-${{ matrix.platform }} ;; 'watchOS' ) xcodebuild test -scheme ${{ env.SCHEME_NAME }} -destination 'name=${{ env.WATCHOS_SIMULATOR_NAME }}' -resultBundlePath TestResults-${{ matrix.platform }} ;; + 'visionOS' ) xcodebuild test -scheme ${{ env.SCHEME_NAME }} -destination 'name=${{ env.VISIONOS_SIMULATOR_NAME }}' -resultBundlePath TestResults-${{ matrix.platform }} ;; esac - uses: kishikawakatsumi/xcresulttool@v1 with: @@ -79,7 +82,7 @@ jobs: if: success() || failure() - name: Upload Xcode DerivedData if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Xcode DerivedData (${{ matrix.platform }}) path: | diff --git a/.github/workflows/xcodebuild_for_example_app.yml b/.github/workflows/xcodebuild_for_example_app.yml index 3044a289..208d9bb6 100644 --- a/.github/workflows/xcodebuild_for_example_app.yml +++ b/.github/workflows/xcodebuild_for_example_app.yml @@ -9,8 +9,8 @@ on: env: SCHEME_NAME: TRETNFCKitExample - IOS_SIMULATOR_NAME: iPhone 14 Pro - XCODE_SELECT_PATH: '/Applications/Xcode_14.3.app/Contents/Developer' + IOS_SIMULATOR_NAME: iPhone 15 Pro + XCODE_SELECT_PATH: '/Applications/Xcode_15.2.app/Contents/Developer' jobs: show_software_information: @@ -21,7 +21,7 @@ jobs: os: [macos-13] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Show Xcode list run: ls -n /Applications | grep 'Xcode' - name: Show the default version of Xcode @@ -44,7 +44,7 @@ jobs: platform: ['iOS'] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set Xcode version run: sudo xcode-select -s '${{ env.XCODE_SELECT_PATH }}' - name: Build the scheme @@ -55,14 +55,14 @@ jobs: working-directory: ./Examples - name: Upload Xcode Build log if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: xcodebuild log (${{ matrix.platform }}) path: | Examples/xcodebuild-${{ matrix.platform }}.log - name: Upload Xcode DerivedData if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Xcode DerivedData (${{ matrix.platform }}) path: | diff --git a/Package.swift b/Package.swift index fd104fe1..0d4fc601 100644 --- a/Package.swift +++ b/Package.swift @@ -1,13 +1,27 @@ -// swift-tools-version: 5.8 +// swift-tools-version: 5.9 import PackageDescription let packageName = "TRETNFCKit" +extension SwiftSetting { + static let forwardTrailingClosures: Self = .enableUpcomingFeature("ForwardTrailingClosures") + static let strictConcurrency: Self = .enableUpcomingFeature("StrictConcurrency") + static let existentialAny: Self = .enableUpcomingFeature("ExistentialAny") + static let bareSlashRegexLiterals: Self = .enableUpcomingFeature("BareSlashRegexLiterals") + static let conciseMagicFile: Self = .enableUpcomingFeature("ConciseMagicFile") + static let importObjcForwardDeclarations: Self = .enableUpcomingFeature("ImportObjcForwardDeclarations") + static let disableOutwardActorInference: Self = .enableUpcomingFeature("DisableOutwardActorInference") +} + let swiftSettings: [SwiftSetting] = [ - .enableUpcomingFeature("ExistentialAny"), - .enableUpcomingFeature("StrictConcurrency"), - .unsafeFlags(["-enable-actor-data-race-checks"], .when(configuration: .debug)), + .forwardTrailingClosures, + .strictConcurrency, + .existentialAny, + .bareSlashRegexLiterals, + .conciseMagicFile, + .importObjcForwardDeclarations, + .disableOutwardActorInference, ] var products: [Product] = [] @@ -58,7 +72,7 @@ targets.append( let package = Package( name: packageName, defaultLocalization: "en", - platforms: [.iOS(.v13), .macOS(.v10_15), .macCatalyst(.v13), .tvOS(.v13), .watchOS(.v6)], + platforms: [.iOS(.v13), .macOS(.v10_15), .macCatalyst(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1)], products: products, targets: targets ) diff --git a/README.md b/README.md index 0d015e9f..23416c5d 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ A wrapper for Core NFC and a useful helper when using NFC, leveraging Swift feat [![MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/treastrain/TRETJapanNFCReader/blob/master/LICENSE) [![GitHub Stars](https://img.shields.io/github/stars/treastrain/TRETJapanNFCReader)](https://github.com/treastrain/TRETJapanNFCReader/stargazers) \ -![Platform: iOS & iPadOS|macOS|tvOS|watchOS](https://img.shields.io/badge/Platform-iOS%20%26%20iPadOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS-lightgrey.svg) +![Platform: iOS & iPadOS|macOS|tvOS|watchOS|visionOS](https://img.shields.io/badge/Platform-iOS%20%26%20iPadOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20visionOS-lightgrey.svg) ![SwiftUI compatible](https://img.shields.io/badge/SwiftUI-compatible-brightgreen.svg) \ -![Swift: 5.7](https://img.shields.io/badge/Swift-5.7-orange.svg) +![Swift: 5.9](https://img.shields.io/badge/Swift-5.9-orange.svg) [![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager) \ [![Twitter: @treastrain](https://img.shields.io/twitter/follow/treastrain?label=%40treastrain&style=social)](https://twitter.com/treastrain) \ [![Swift Build & Test](https://github.com/treastrain/TRETJapanNFCReader/actions/workflows/swift.yml/badge.svg?branch=tretnfckit-main)](https://github.com/treastrain/TRETJapanNFCReader/actions/workflows/swift.yml) @@ -301,10 +301,12 @@ Text("some view") - Mac Catalyst 13.0+ - tvOS 13.0+ - watchOS 6.0+ -- Xcode 14.0+ - - Swift 5.7+ +- visionOS 1.0+ +- Xcode 15.0+ + - Swift 5.9+ -**:warning: Features related to NFC tag reading are only available in iOS 13.0+. :warning:** +> [!NOTE] +> Features related to NFC tag reading are only available in iOS 13.0+. # License MIT License diff --git a/Tests/NativeTagTests/NativeTagTests.swift b/Tests/NativeTagTests/NativeTagTests.swift index c1e5c0ce..805ebc39 100644 --- a/Tests/NativeTagTests/NativeTagTests.swift +++ b/Tests/NativeTagTests/NativeTagTests.swift @@ -21,7 +21,14 @@ final class NativeTagTests: XCTestCase { let reader = NFCReader() do { - try await reader.read(pollingOption: [], detectingAlertMessage: alertMessage) { _, _ in .none } + try await reader.read( + pollingOption: [], + taskPriority: nil, + detectingAlertMessage: alertMessage, + didBecomeActive: { _ in }, + didInvalidate: { _ in }, + didDetect: { _, _ in .none } + ) XCTFail("The `NFCReaderErrorInvalidParameter` is not thrown.") } catch { XCTAssertEqual((error as! NFCReaderError).code, .readerErrorInvalidParameter) @@ -41,7 +48,14 @@ final class NativeTagTests: XCTestCase { let alertMessage = "Detecting Alert Message" let reader = NFCReader() - try await reader.read(pollingOption: .iso18092, detectingAlertMessage: alertMessage) { _, _ in .none } + try await reader.read( + pollingOption: .iso18092, + taskPriority: nil, + detectingAlertMessage: alertMessage, + didBecomeActive: { _ in }, + didInvalidate: { _ in }, + didDetect: { _, _ in .none } + ) let tagReaderOrNil = await reader.readerAndDelegate?.reader let tagReader = try XCTUnwrap(tagReaderOrNil) let tagReaderAlertMessage = await tagReader.alertMessage @@ -59,7 +73,14 @@ final class NativeTagTests: XCTestCase { let alertMessage = "Detecting Alert Message" let reader = NFCReader() - try await reader.read(pollingOption: [.iso14443, .iso15693, .iso18092], detectingAlertMessage: alertMessage) { _, _ in .none } + try await reader.read( + pollingOption: [.iso14443, .iso15693, .iso18092], + taskPriority: nil, + detectingAlertMessage: alertMessage, + didBecomeActive: { _ in }, + didInvalidate: { _ in }, + didDetect: { _, _ in .none } + ) let tagReaderOrNil = await reader.readerAndDelegate?.reader let tagReader = try XCTUnwrap(tagReaderOrNil) let tagReaderAlertMessage = await tagReader.alertMessage