Skip to content

Commit

Permalink
Adopt Swift 6 and Xcode 16 (#322)
Browse files Browse the repository at this point in the history
* Adopt Swift 6 and Xcode 16

* Project updates

* Lower macOS deployment to macOS 10.13 – match README

* Remove @available checks that no longer apply

* Remove renamed method hints

* Remove v2 (objc) compatibility tests

* Update README

* Add migration method
  • Loading branch information
dfed authored Oct 19, 2024
1 parent e900692 commit 23bad01
Show file tree
Hide file tree
Showing 51 changed files with 885 additions and 2,914 deletions.
125 changes: 14 additions & 111 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,15 @@ concurrency:
cancel-in-progress: true

jobs:
xcode-build-13:
name: Xcode 13 Build
runs-on: macOS-12
strategy:
matrix:
platforms: [
'iOS_15',
'tvOS_15',
]
fail-fast: false
timeout-minutes: 30
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_13.4.1.app/Contents/Developer
- name: Build and Test Framework
run: Scripts/build.swift ${{ matrix.platforms }} xcode
- name: Upload Coverage Reports
if: success()
run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }}
xcode-build-14:
name: Xcode 14 Build
xcode-build-16:
name: Xcode 16 Build
runs-on: macOS-14
strategy:
matrix:
platforms: [
'iOS_16',
'tvOS_16',
'watchOS_9',
'iOS_18',
'tvOS_18',
'watchOS_11',
]
fail-fast: false
timeout-minutes: 30
Expand All @@ -52,31 +29,7 @@ jobs:
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer
- name: Build and Test Framework
run: Scripts/build.swift ${{ matrix.platforms }} xcode
- name: Upload Coverage Reports
if: success()
run: Scripts/upload-coverage-reports.sh ${{ matrix.platforms }}
xcode-build-15:
name: Xcode 15 Build
runs-on: macOS-14
strategy:
matrix:
platforms: [
'iOS_17',
'tvOS_17',
'watchOS_10',
]
fail-fast: false
timeout-minutes: 30
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_15.3.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
- name: Build and Test Framework
run: Scripts/build.swift ${{ matrix.platforms }} xcode
- name: Upload Coverage Reports
Expand All @@ -92,9 +45,9 @@ jobs:
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_15.3.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
- name: Lint Podspec
run: bundle exec pod lib lint --verbose --fail-fast --swift-version=5.4
run: bundle exec pod lib lint --verbose --fail-fast --swift-version=6.0
carthage:
name: Carthage
runs-on: macOS-14
Expand All @@ -105,69 +58,21 @@ jobs:
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_15.3.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
- name: Install Carthage
run: brew outdated carthage || brew upgrade carthage
- name: Build Framework
run: carthage build --verbose --no-skip-current --use-xcframeworks
spm-12:
name: SPM Build macOS 12
runs-on: macOS-12
strategy:
matrix:
platforms: [
'iOS_15',
'tvOS_15',
'watchOS_8',
'macOS_12',
]
fail-fast: false
timeout-minutes: 30
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_13.4.1.app/Contents/Developer
- name: Prepare Simulator Runtimes
run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }}
- name: Build Framework
run: Scripts/build.swift ${{ matrix.platforms }} spm
spm-13:
name: SPM Build macOS 13
runs-on: macOS-13
strategy:
matrix:
platforms: [
'iOS_16',
'tvOS_16',
'watchOS_9',
'macOS_13',
]
fail-fast: false
timeout-minutes: 30
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer
- name: Prepare Simulator Runtimes
run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }}
- name: Build Framework
run: Scripts/build.swift ${{ matrix.platforms }} spm
spm-14:
name: SPM Build macOS 14
runs-on: macOS-14
strategy:
matrix:
platforms: [
'iOS_17',
'tvOS_17',
'watchOS_10',
'macOS_14',
'iOS_18',
'tvOS_18',
'watchOS_11',
'macOS_15',
]
fail-fast: false
timeout-minutes: 30
Expand All @@ -177,8 +82,6 @@ jobs:
- name: Bundle Install
run: bundle install
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_15.3.app/Contents/Developer
- name: Prepare Simulator Runtimes
run: Scripts/github/prepare-simulators.sh ${{ matrix.platforms }}
run: sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer
- name: Build Framework
run: Scripts/build.swift ${{ matrix.platforms }} spm
36 changes: 18 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,25 @@ GEM
base64
nkf
rexml
activesupport (7.1.3.2)
activesupport (7.2.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.2.0)
bigdecimal (3.1.7)
bigdecimal (3.1.8)
claide (1.1.0)
cocoapods (1.15.2)
addressable (~> 2.8)
Expand Down Expand Up @@ -62,43 +63,42 @@ GEM
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
drb (2.2.1)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.16.3)
ffi (1.17.0)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.14.4)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
json (2.7.2)
minitest (5.22.3)
logger (1.6.1)
minitest (5.25.1)
molinillo (0.8.0)
mutex_m (0.2.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
nkf (0.2.0)
public_suffix (4.0.7)
rexml (3.3.6)
strscan
rexml (3.3.8)
ruby-macho (2.5.1)
strscan (3.1.0)
securerandom (0.3.1)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.25.0)
xcodeproj (1.25.1)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (>= 3.3.2, < 4.0)
rexml (>= 3.3.6, < 4.0)

PLATFORMS
ruby
Expand All @@ -107,4 +107,4 @@ DEPENDENCIES
cocoapods (~> 1.15.0)

BUNDLED WITH
2.3.7
2.5.16
22 changes: 13 additions & 9 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
// swift-tools-version:5.4
// swift-tools-version:6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "Valet",
platforms: [
.iOS(.v9),
.tvOS(.v9),
.watchOS(.v2),
.macOS(.v10_11),
.iOS(.v12),
.tvOS(.v12),
.watchOS(.v4),
.macOS(.v10_13),
],
products: [
.library(
name: "Valet",
targets: ["Valet"]),
targets: ["Valet"]
),
],
targets: [
.target(
name: "Valet",
dependencies: []),
],
swiftLanguageVersions: [.v5]
dependencies: [],
swiftSettings: [
.swiftLanguageMode(.v6),
]
),
]
)
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@ Install with [CocoaPods](http://cocoapods.org) by adding the following to your `
on iOS:

```
platform :ios, '9.0'
platform :ios, '12.0'
use_frameworks!
pod 'Valet'
```

on tvOS:

```
platform :tvos, '9.0'
platform :tvos, '12.0'
use_frameworks!
pod 'Valet'
```

on watchOS:

```
platform :watchos, '2.0'
platform :watchos, '4.0'
use_frameworks!
pod 'Valet'
```

on macOS:

```
platform :osx, '10.11'
platform :osx, '10.13'
use_frameworks!
pod 'Valet'
```
Expand All @@ -64,7 +64,7 @@ Install with [Swift Package Manager](https://github.com/apple/swift-package-mana

```swift
dependencies: [
.package(url: "https://github.com/Square/Valet", from: "4.0.0"),
.package(url: "https://github.com/Square/Valet", from: "5.0.0"),
],
```

Expand Down Expand Up @@ -239,15 +239,15 @@ Valet guarantees that reading and writing operations will succeed as long as wri
## Requirements
* Xcode 13.0 or later.
* iOS 9 or later.
* tvOS 9 or later.
* watchOS 2 or later.
* macOS 10.11 or later.
* Xcode 16.0 or later.
* iOS 12 or later.
* tvOS 12 or later.
* watchOS 4 or later.
* macOS 10.13 or later.
## Migrating from prior Valet versions
The good news: most Valet configurations do _not_ have to migrate keychain data when upgrading from an older version of Valet. All Valet objects are backwards compatible with their counterparts from prior versions. We have exhaustive unit tests to prove it (search for `test_backwardsCompatibility`). Valets that have had their configurations deprecated by Apple will need to migrate stored data.
The good news: most Valet configurations do _not_ have to migrate keychain data when upgrading from an older version of Valet. All Valet objects are backwards compatible with their counterparts from prior versions. Valets that have had their configurations deprecated by Apple will need to migrate stored data.
The bad news: there are multiple source-breaking API changes from prior versions.
Expand All @@ -268,6 +268,12 @@ You'll also need to continue reading through the [migration from Valet 3](#migra
1. Most APIs that returned optionals or `Bool` values have been migrated to returning a nonoptional and throwing if an error is encountered. Ignoring the error that can be thrown by each API will keep your code flow behaving the same as it did before. Walking through one example: in Swift, `let secret: String? = myValet.string(forKey: myKey)` becomes `let secret: String? = try? myValet.string(forKey: myKey)`. In Objective-C, `NSString *const secret = [myValet stringForKey:myKey];` becomes `NSString *const secret = [myValet stringForKey:myKey error:nil];`. If you're interested in the reason data wasn't returned, use a [do-catch](https://docs.swift.org/swift-book/LanguageGuide/ErrorHandling.html#ID541) statement in Swift, or pass in an `NSError` to each API call and inspect the output in Objective-C. Each method clearly documents the `Error` type it can `throw`. [See examples above](#reading-and-writing).
1. The class method used to create a Valet that can share secrets between applications using keychain shared access groups has changed. In order to prevent the incorrect detection of the App ID prefix [in rare circumstances](https://github.com/square/Valet/pull/218), the App ID prefix must now be explicitly passed into these methods. To create a shared access groups Valet, you'll need to create a `SharedGroupIdentifier(appIDPrefix:nonEmptyGroup:)`. [See examples above](#sharing-secrets-among-multiple-applications-using-an-app-groups-entitlement).
### Migrating from Valet 4
1. Most `throw`ing methods now utilize [typed throws](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0413-typed-throws.md), which may render certain `catch` statements obsolete.
1. `SecureEnclaveValet`'s `withPrompt` API were removed on tvOS and watchOS, as recent API updates revealed that this API never actually showed a prompt on device. New API were added to perform the same actions without a custom prompt.
1. `SinglePromptSecureEnclaveValet` was removed from watchOS, as recent API updates revealed this API did not work as intended on watchOS. If you were previously deploying a ``SinglePromptSecureEnclaveValet`` on watchOS, use the method `migrateObjectsFromSinglePromptSecureEnclaveValet(removeOnCompletion:)` on a `SecureEnclaveValet` with the same identifiers and access control to migrate your existing key:value pairs.
## Contributing
We’re glad you’re interested in Valet, and we’d love to see where you take it. Please read our [contributing guidelines](Contributing.md) prior to submitting a Pull Request.
Expand Down
Loading

0 comments on commit 23bad01

Please sign in to comment.