Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: update tutorial with swift (#33248)

Yudai Suzukif203d6cbd7bf
diff --git a/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx b/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx
index 25a80a2984f..8277c06943a 100644
--- a/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx
+++ b/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx
@@ -33,6 +33,7 @@ These variables will be exposed on the application, and that's completely fine s
[Row Level Security](/docs/guides/auth#row-level-security) enabled on your database.
```swift Supabase.swift
+import Foundation
import Supabase
let supabase = SupabaseClient(
@@ -182,7 +183,8 @@ struct ProfileView: View {
do {
let currentUser = try await supabase.auth.session.user
- let profile: Profile = try await supabase
+ let profile: Profile =
+ try await supabase
.from("profiles")
.select()
.eq("id", value: currentUser.id)
@@ -339,6 +341,11 @@ enum TransferError: Error {
#### Add `PhotosPicker` to profile page
```swift ProfileView.swift
++ import PhotosUI
++ import Storage
++ import Supabase
+import SwiftUI
+
struct ProfileView: View {
@State var username = ""
@State var fullName = ""
@@ -421,7 +428,8 @@ struct ProfileView: View {
do {
let currentUser = try await supabase.auth.session.user
- let profile: Profile = try await supabase.database
+ let profile: Profile =
+ try await supabase
.from("profiles")
.select()
.eq("id", value: currentUser.id)
@@ -458,7 +466,7 @@ struct ProfileView: View {
+ avatarURL: imageURL
)
- try await supabase.database
+ try await supabase
.from("profiles")
.update(updatedProfile)
.eq("id", value: currentUser.id)
@@ -492,8 +500,8 @@ struct ProfileView: View {
+ try await supabase.storage
+ .from("avatars")
+ .upload(
-+ path: filePath,
-+ file: data,
++ filePath,
++ data: data,
+ options: FileOptions(contentType: "image/jpeg")
+ )
+