Skip to content

Commit a305ff2

Browse files
authored
docs(swift): rename authStateChanges and remove File from upload method (supabase#19067)
docs: fix authStateChanges and upload documentation
1 parent 3ac4759 commit a305ff2

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

spec/supabase_swift_v1.yml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -415,25 +415,25 @@ functions:
415415
let session = try await supabase.auth.refreshSession(refreshToken: "custom-refresh-token")
416416
```
417417
- id: on-auth-state-change
418-
title: "onAuthStateChange()"
418+
title: "authStateChanges"
419419
notes: |
420420
- Types of auth events: `INITIAL_SESSION`, `SIGNED_IN`, `SIGNED_OUT`, `TOKEN_REFRESHED`, `USER_UPDATED`, `PASSWORD_RECOVERY`, `MFA_CHALLENGE_VERIFIED`
421-
- The `INITIAL_SESSION` can be used to allow you to invoke the callback function when `onAuthStateChange` is first called.
421+
- The `INITIAL_SESSION` can be used to allow you to invoke the callback function when `authStateChanges` is first called.
422422
examples:
423423
- id: listen-to-auth-changes
424424
name: Listen to auth changes
425425
isSpotlight: true
426426
code: |
427427
```swift
428-
for await (event, session) in await supabase.auth.onAuthStateChange() {
428+
for await (event, session) in await supabase.auth.authStateChanges {
429429
print(event, session)
430430
}
431431
```
432432
- id: list-to-a-specific-event
433433
name: Listen to a specific event
434434
code: |
435435
```swift
436-
for await (_, session) in await supabase.auth.onAuthStateChange().filter({ $0.event == .signedIn }) {
436+
for await (_, session) in await supabase.auth.authStateChanges.filter({ $0.event == .signedIn }) {
437437
// handle signIn event.
438438
}
439439
```
@@ -3182,18 +3182,11 @@ functions:
31823182
```swift
31833183
let fileName = "avatar1.png"
31843184
3185-
let file = File(
3186-
name: fileName,
3187-
data: fileData,
3188-
fileName: fileName,
3189-
contentType: "image/png"
3190-
)
3191-
31923185
try await supabase.storage
31933186
.from("avatars")
31943187
.upload(
31953188
path: "public/\(fileName)",
3196-
file: file,
3189+
file: fileData,
31973190
fileOptions: FileOptions(
31983191
cacheControl: "3600",
31993192
upsert: false
@@ -3216,18 +3209,11 @@ functions:
32163209
```swift
32173210
let fileName = "avatar1.png"
32183211
3219-
let file = File(
3220-
name: fileName,
3221-
data: fileData,
3222-
fileName: fileName,
3223-
contentType: "image/png"
3224-
)
3225-
32263212
try await supabase.storage
32273213
.from("avatars")
32283214
.update(
32293215
path: "public/\(fileName)",
3230-
file: file,
3216+
file: fileData,
32313217
fileOptions: FileOptions(
32323218
cacheControl: "3600",
32333219
upsert: true

0 commit comments

Comments
 (0)