Skip to content

Commit

Permalink
Merge pull request #131 from treastrain/update-environment
Browse files Browse the repository at this point in the history
Update to Xcode 15 (Swift 5.9, visionOS, CI)
  • Loading branch information
treastrain authored Jan 28, 2024
2 parents 99b538a + fa5e6e2 commit 6cb20c8
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 33 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -33,15 +33,15 @@ 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 }}'
- name: Build
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: |
Expand All @@ -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: |
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/xcodebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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:
Expand All @@ -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: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/xcodebuild_for_example_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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: |
Expand Down
24 changes: 19 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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] = []
Expand Down Expand Up @@ -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
)
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
27 changes: 24 additions & 3 deletions Tests/NativeTagTests/NativeTagTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ final class NativeTagTests: XCTestCase {

let reader = NFCReader<NativeTag>()
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)
Expand All @@ -41,7 +48,14 @@ final class NativeTagTests: XCTestCase {
let alertMessage = "Detecting Alert Message"

let reader = NFCReader<NativeTag>()
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
Expand All @@ -59,7 +73,14 @@ final class NativeTagTests: XCTestCase {
let alertMessage = "Detecting Alert Message"

let reader = NFCReader<NativeTag>()
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
Expand Down

0 comments on commit 6cb20c8

Please sign in to comment.