Skip to content

Commit af48c14

Browse files
grdsdevclaude
andcommitted
feat: drop Swift 5.10 (#835)
* feat: drop Swift 5.10 * remove CI run from macOS legacy * fix * use fail-fast = false * trying to fix tests * fix: resolve Swift 6.0 type inference issues in RealtimeTests This commit fixes two Swift 6.0 compiler errors that were causing CI failures on Xcode 16.4: 1. In setUp(), explicitly unwrap the `client` implicitly unwrapped optional when captured in the wsTransport closure 2. In testBroadcastWithHTTP(), explicitly unwrap the `sut` implicitly unwrapped optional when captured in the mock response closure These changes are needed because Swift 6.0 is stricter about type inference with implicitly unwrapped optionals in closure capture lists. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: resolve more Swift 6 type inference issues --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent bf0a345 commit af48c14

24 files changed

+89
-176
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ body:
4040
attributes:
4141
label: Swift Version
4242
description: What version of Swift are you using?
43-
placeholder: ex. 5.10
43+
placeholder: ex. 6.0
4444
validations:
4545
required: true
4646

.github/workflows/ci.yml

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
name: xcodebuild (macOS latest)
4848
runs-on: macos-15
4949
strategy:
50+
fail-fast: false
5051
matrix:
5152
command: [test, ""]
5253
platform: [IOS, MACOS]
@@ -81,41 +82,6 @@ jobs:
8182
github-token: ${{ secrets.GITHUB_TOKEN }}
8283
file: lcov.info
8384

84-
macos-legacy:
85-
name: xcodebuild (macOS legacy)
86-
runs-on: macos-14
87-
strategy:
88-
matrix:
89-
command: [test, ""]
90-
platform: [IOS, MACOS, MAC_CATALYST]
91-
xcode: ["15.4"]
92-
include:
93-
- { command: test, skip_release: 1 }
94-
steps:
95-
- uses: actions/checkout@v5
96-
- name: Select Xcode ${{ matrix.xcode }}
97-
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
98-
- name: List available devices
99-
run: xcrun simctl list devices available
100-
- name: Cache derived data
101-
uses: actions/cache@v4
102-
with:
103-
path: |
104-
~/.derivedData
105-
key: |
106-
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }}
107-
restore-keys: |
108-
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-
109-
- name: Set IgnoreFileSystemDeviceInodeChanges flag
110-
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
111-
- name: Update mtime for incremental builds
112-
uses: chetan/git-restore-mtime-action@v2
113-
- name: Debug
114-
run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Debug PLATFORM="${{ matrix.platform }}" xcodebuild
115-
- name: Release
116-
if: matrix.skip_release != '1'
117-
run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Release PLATFORM="${{ matrix.platform }}" xcodebuild
118-
11985
spm:
12086
runs-on: macos-15
12187
strategy:

Examples/Examples/Profile/UserIdentityList.swift

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -237,30 +237,28 @@ struct UserIdentityList: View {
237237
}
238238
.id(id)
239239
.navigationTitle("Linked Identities")
240-
#if swift(>=5.10)
241-
.toolbar {
242-
ToolbarItem(placement: .primaryAction) {
243-
if !providers.isEmpty {
244-
Menu {
245-
ForEach(providers) { provider in
246-
Button {
247-
Task {
248-
await linkProvider(provider)
249-
}
250-
} label: {
251-
Label(
252-
provider.rawValue.capitalized,
253-
systemImage: iconForProvider(provider.rawValue)
254-
)
240+
.toolbar {
241+
ToolbarItem(placement: .primaryAction) {
242+
if !providers.isEmpty {
243+
Menu {
244+
ForEach(providers) { provider in
245+
Button {
246+
Task {
247+
await linkProvider(provider)
255248
}
249+
} label: {
250+
Label(
251+
provider.rawValue.capitalized,
252+
systemImage: iconForProvider(provider.rawValue)
253+
)
256254
}
257-
} label: {
258-
Label("Link Account", systemImage: "plus")
259255
}
256+
} label: {
257+
Label("Link Account", systemImage: "plus")
260258
}
261259
}
262260
}
263-
#endif
261+
}
264262
}
265263

266264
private func iconForProvider(_ provider: String) -> String {

Examples/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.7
1+
// swift-tools-version:6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import Foundation

Examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Features:
171171

172172
## Prerequisites
173173

174-
- Xcode 15.0 or later
174+
- Xcode 16.0 or later
175175
- iOS 17.0+ / macOS 14.0+ or later
176176
- [Supabase CLI](https://supabase.com/docs/guides/cli) installed
177177

Package.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.10
1+
// swift-tools-version:6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import Foundation
@@ -204,7 +204,8 @@ let package = Package(
204204
"Mocker",
205205
]
206206
),
207-
]
207+
],
208+
swiftLanguageModes: [.v6]
208209
)
209210

210211
for target in package.targets where !target.isTest {

Package@swift-6.1.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ let package = Package(
204204
]
205205
),
206206
],
207-
swiftLanguageModes: [.v5]
207+
swiftLanguageModes: [.v6]
208208
)
209209

210210
for target in package.targets where !target.isTest {

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Supabase SDK for Swift. Mirrors the design of [supabase-js](https://github.com/s
1111

1212
### Requirements
1313
- iOS 16.0+ / macOS 13+ / tvOS 16+ / watchOS 9+ / visionOS 1+
14-
- Xcode 15.3+
15-
- Swift 5.10+
14+
- Xcode 16.0+
15+
- Swift 6.0+
1616

1717
> [!IMPORTANT]
1818
> Check the [Support Policy](#support-policy) to learn when dropping Xcode, Swift, and platform versions will not be considered a **breaking change**.

Sources/Auth/AuthClient.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private actor GlobalJWKSCache {
6060
private let globalJWKSCache = GlobalJWKSCache()
6161

6262
public actor AuthClient {
63-
static var globalClientID = 0
63+
static let globalClientID = LockIsolated(0)
6464
nonisolated let clientID: AuthClientID
6565

6666
nonisolated private var api: APIClient { Dependencies[clientID].api }
@@ -122,8 +122,7 @@ public actor AuthClient {
122122
/// - Parameters:
123123
/// - configuration: The client configuration.
124124
public init(configuration: Configuration) {
125-
AuthClient.globalClientID += 1
126-
clientID = AuthClient.globalClientID
125+
clientID = AuthClient.globalClientID.withValue { $0 += 1; return $0 }
127126

128127
Dependencies[clientID] = Dependencies(
129128
configuration: configuration,

Sources/Storage/Helpers.swift

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,21 @@ import Foundation
1717
import UniformTypeIdentifiers
1818

1919
func mimeType(forPathExtension pathExtension: String) -> String {
20-
#if swift(>=5.9)
21-
if #available(iOS 14, macOS 11, tvOS 14, watchOS 7, visionOS 1, *) {
22-
return UTType(filenameExtension: pathExtension)?.preferredMIMEType
23-
?? "application/octet-stream"
24-
} else {
25-
if let id = UTTypeCreatePreferredIdentifierForTag(
26-
kUTTagClassFilenameExtension, pathExtension as CFString, nil
27-
)?.takeRetainedValue(),
28-
let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?
29-
.takeRetainedValue()
30-
{
31-
return contentType as String
32-
}
33-
34-
return "application/octet-stream"
20+
if #available(iOS 14, macOS 11, tvOS 14, watchOS 7, visionOS 1, *) {
21+
return UTType(filenameExtension: pathExtension)?.preferredMIMEType
22+
?? "application/octet-stream"
23+
} else {
24+
if let id = UTTypeCreatePreferredIdentifierForTag(
25+
kUTTagClassFilenameExtension, pathExtension as CFString, nil
26+
)?.takeRetainedValue(),
27+
let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?
28+
.takeRetainedValue()
29+
{
30+
return contentType as String
3531
}
36-
#else
37-
if #available(iOS 14, macOS 11, tvOS 14, watchOS 7, *) {
38-
return UTType(filenameExtension: pathExtension)?.preferredMIMEType
39-
?? "application/octet-stream"
40-
} else {
41-
if let id = UTTypeCreatePreferredIdentifierForTag(
42-
kUTTagClassFilenameExtension, pathExtension as CFString, nil
43-
)?.takeRetainedValue(),
44-
let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?
45-
.takeRetainedValue()
46-
{
47-
return contentType as String
48-
}
4932

50-
return "application/octet-stream"
51-
}
52-
#endif
33+
return "application/octet-stream"
34+
}
5335
}
5436
#else
5537

0 commit comments

Comments
 (0)