Skip to content

Commit 15bf431

Browse files
authored
Merge 47f0481 into af550d7
2 parents af550d7 + 47f0481 commit 15bf431

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+260
-4426
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: 8 additions & 7 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
@@ -7,11 +7,11 @@ import PackageDescription
77
let package = Package(
88
name: "Supabase",
99
platforms: [
10-
.iOS(.v13),
11-
.macCatalyst(.v13),
12-
.macOS(.v10_15),
13-
.watchOS(.v6),
14-
.tvOS(.v13),
10+
.iOS(.v16),
11+
.macCatalyst(.v16),
12+
.macOS(.v13),
13+
.watchOS(.v9),
14+
.tvOS(.v16),
1515
],
1616
products: [
1717
.library(name: "Auth", targets: ["Auth"]),
@@ -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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import PackageDescription
77
let package = Package(
88
name: "Supabase",
99
platforms: [
10-
.iOS(.v13),
11-
.macCatalyst(.v13),
12-
.macOS(.v10_15),
13-
.watchOS(.v6),
14-
.tvOS(.v13),
10+
.iOS(.v16),
11+
.macCatalyst(.v16),
12+
.macOS(.v13),
13+
.watchOS(.v9),
14+
.tvOS(.v16),
1515
],
1616
products: [
1717
.library(name: "Auth", targets: ["Auth"]),
@@ -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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Supabase SDK for Swift. Mirrors the design of [supabase-js](https://github.com/s
1010
## Usage
1111

1212
### Requirements
13-
- iOS 13.0+ / macOS 10.15+ / tvOS 13+ / watchOS 6+ / visionOS 1+
14-
- Xcode 15.3+
15-
- Swift 5.10+
13+
- iOS 16.0+ / macOS 13+ / tvOS 16+ / watchOS 9+ / visionOS 1+
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 & 4 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,
@@ -702,7 +701,6 @@ public actor AuthClient {
702701
/// - Note: This method support the PKCE flow.
703702
/// - Warning: Do not call `start()` on the `ASWebAuthenticationSession` object inside the
704703
/// `configure` closure, as the method implementation calls it already.
705-
@available(watchOS 6.2, tvOS 16.0, *)
706704
@discardableResult
707705
public func signInWithOAuth(
708706
provider: Provider,

Sources/Auth/AuthError.swift

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -118,129 +118,6 @@ extension ErrorCode {
118118
}
119119

120120
public enum AuthError: LocalizedError, Equatable {
121-
@available(
122-
*,
123-
deprecated,
124-
message:
125-
"Error used to be thrown when no exp claim was found in JWT during setSession(accessToken:refreshToken:) method."
126-
)
127-
case missingExpClaim
128-
129-
@available(
130-
*,
131-
deprecated,
132-
message:
133-
"Error used to be thrown when provided JWT wasn't valid during setSession(accessToken:refreshToken:) method."
134-
)
135-
case malformedJWT
136-
137-
@available(*, deprecated, renamed: "sessionMissing")
138-
public static var sessionNotFound: AuthError { .sessionMissing }
139-
140-
/// Error thrown during PKCE flow.
141-
@available(
142-
*,
143-
deprecated,
144-
renamed: "pkceGrantCodeExchange",
145-
message: "Error was grouped in `pkceGrantCodeExchange`, please use it instead of `pkce`."
146-
)
147-
public static func pkce(_ reason: PKCEFailureReason) -> AuthError {
148-
switch reason {
149-
case .codeVerifierNotFound:
150-
.pkceGrantCodeExchange(message: "A code verifier wasn't found in PKCE flow.")
151-
case .invalidPKCEFlowURL:
152-
.pkceGrantCodeExchange(message: "Not a valid PKCE flow url.")
153-
}
154-
}
155-
156-
@available(*, deprecated, message: "Use `pkceGrantCodeExchange` instead.")
157-
public enum PKCEFailureReason: Sendable {
158-
/// Code verifier not found in the URL.
159-
case codeVerifierNotFound
160-
161-
/// Not a valid PKCE flow URL.
162-
case invalidPKCEFlowURL
163-
}
164-
165-
@available(*, deprecated, renamed: "implicitGrantRedirect")
166-
public static var invalidImplicitGrantFlowURL: AuthError {
167-
.implicitGrantRedirect(message: "Not a valid implicit grant flow url.")
168-
}
169-
170-
@available(
171-
*,
172-
deprecated,
173-
message:
174-
"This error is never thrown, if you depend on it, you can remove the logic as it never happens."
175-
)
176-
case missingURL
177-
178-
@available(
179-
*,
180-
deprecated,
181-
message:
182-
"Error used to be thrown on methods which required a valid redirect scheme, such as signInWithOAuth. This is now considered a programming error an a assertion is triggered in case redirect scheme isn't provided."
183-
)
184-
case invalidRedirectScheme
185-
186-
@available(
187-
*,
188-
deprecated,
189-
renamed: "api(message:errorCode:underlyingData:underlyingResponse:)"
190-
)
191-
public static func api(_ error: APIError) -> AuthError {
192-
let message = error.msg ?? error.error ?? error.errorDescription ?? "Unexpected API error."
193-
if let weakPassword = error.weakPassword {
194-
return .weakPassword(message: message, reasons: weakPassword.reasons)
195-
}
196-
197-
return .api(
198-
message: message,
199-
errorCode: .unknown,
200-
underlyingData: (try? AuthClient.Configuration.jsonEncoder.encode(error)) ?? Data(),
201-
underlyingResponse: HTTPURLResponse(
202-
url: defaultAuthURL,
203-
statusCode: error.code ?? 500,
204-
httpVersion: nil,
205-
headerFields: nil
206-
)!
207-
)
208-
}
209-
210-
/// An error returned by the API.
211-
@available(
212-
*,
213-
deprecated,
214-
renamed: "api(message:errorCode:underlyingData:underlyingResponse:)"
215-
)
216-
public struct APIError: Error, Codable, Sendable, Equatable {
217-
/// A basic message describing the problem with the request. Usually missing if
218-
/// ``AuthError/APIError/error`` is present.
219-
public var msg: String?
220-
221-
/// The HTTP status code. Usually missing if ``AuthError/APIError/error`` is present.
222-
public var code: Int?
223-
224-
/// Certain responses will contain this property with the provided values.
225-
///
226-
/// Usually one of these:
227-
/// - `invalid_request`
228-
/// - `unauthorized_client`
229-
/// - `access_denied`
230-
/// - `server_error`
231-
/// - `temporarily_unavailable`
232-
/// - `unsupported_otp_type`
233-
public var error: String?
234-
235-
/// Certain responses that have an ``AuthError/APIError/error`` property may have this property
236-
/// which describes the error.
237-
public var errorDescription: String?
238-
239-
/// Only returned when signing up if the password used is too weak. Inspect the
240-
/// ``WeakPassword/reasons`` and ``AuthError/APIError/msg`` property to identify the causes.
241-
public var weakPassword: WeakPassword?
242-
}
243-
244121
/// Error thrown when a session is required to proceed, but none was found, either thrown by the client, or returned by the server.
245122
case sessionMissing
246123

@@ -274,11 +151,6 @@ public enum AuthError: LocalizedError, Equatable {
274151
let .implicitGrantRedirect(message),
275152
let .jwtVerificationFailed(message):
276153
message
277-
// Deprecated cases
278-
case .missingExpClaim: "Missing expiration claim in the access token."
279-
case .malformedJWT: "A malformed JWT received."
280-
case .invalidRedirectScheme: "Invalid redirect scheme."
281-
case .missingURL: "Missing URL."
282154
}
283155
}
284156

@@ -289,8 +161,6 @@ public enum AuthError: LocalizedError, Equatable {
289161
case let .api(_, errorCode, _, _): errorCode
290162
case .pkceGrantCodeExchange, .implicitGrantRedirect: .unknown
291163
case .jwtVerificationFailed: .invalidJWT
292-
// Deprecated cases
293-
case .missingExpClaim, .malformedJWT, .invalidRedirectScheme, .missingURL: .unknown
294164
}
295165
}
296166

0 commit comments

Comments
 (0)