The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Remove + character from code blocks (#35414)
Max Holmberg9016b84657c1
diff --git a/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx b/apps/docs/content/guides/getting-started/tutorials/with-swift.mdxindex cb41c4408c4..1705ea759e4 100644--- a/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx+++ b/apps/docs/content/guides/getting-started/tutorials/with-swift.mdx@@ -367,9 +367,9 @@ enum TransferError: Error {<$CodeTabs>```swift name=ProfileView.swift-+ import PhotosUI-+ import Storage-+ import Supabase+import PhotosUI+import Storage+import Supabaseimport SwiftUIstruct ProfileView: View {@@ -379,34 +379,34 @@ struct ProfileView: View {@State var isLoading = false-+ @State var imageSelection: PhotosPickerItem?-+ @State var avatarImage: AvatarImage?+ @State var imageSelection: PhotosPickerItem?+ @State var avatarImage: AvatarImage?var body: some View {NavigationStack {Form {-+ Section {-+ HStack {-+ Group {-+ if let avatarImage {-+ avatarImage.image.resizable()-+ } else {-+ Color.clear-+ }-+ }-+ .scaledToFit()-+ .frame(width: 80, height: 80)-+-+ Spacer()-+-+ PhotosPicker(selection: $imageSelection, matching: .images) {-+ Image(systemName: "pencil.circle.fill")-+ .symbolRenderingMode(.multicolor)-+ .font(.system(size: 30))-+ .foregroundColor(.accentColor)-+ }-+ }-+ }+ Section {+ HStack {+ Group {+ if let avatarImage {+ avatarImage.image.resizable()+ } else {+ Color.clear+ }+ }+ .scaledToFit()+ .frame(width: 80, height: 80)++ Spacer()++ PhotosPicker(selection: $imageSelection, matching: .images) {+ Image(systemName: "pencil.circle.fill")+ .symbolRenderingMode(.multicolor)+ .font(.system(size: 30))+ .foregroundColor(.accentColor)+ }+ }+ }Section {TextField("Username", text: $username)@@ -440,10 +440,10 @@ struct ProfileView: View {}}})-+ .onChange(of: imageSelection) { _, newValue in-+ guard let newValue else { return }-+ loadTransferable(from: newValue)-+ }+ .onChange(of: imageSelection) { _, newValue in+ guard let newValue else { return }+ loadTransferable(from: newValue)+ }}.task {await getInitialProfile()@@ -467,9 +467,9 @@ struct ProfileView: View {fullName = profile.fullName ?? ""website = profile.website ?? ""-+ if let avatarURL = profile.avatarURL, !avatarURL.isEmpty {-+ try await downloadImage(path: avatarURL)-+ }+ if let avatarURL = profile.avatarURL, !avatarURL.isEmpty {+ try await downloadImage(path: avatarURL)+ }} catch {debugPrint(error)@@ -481,7 +481,7 @@ struct ProfileView: View {isLoading = truedefer { isLoading = false }do {-+ let imageURL = try await uploadImage()+ let imageURL = try await uploadImage()let currentUser = try await supabase.auth.session.user@@ -489,7 +489,7 @@ struct ProfileView: View {username: username,fullName: fullName,website: website,-+ avatarURL: imageURL+ avatarURL: imageURL)try await supabase@@ -503,36 +503,36 @@ struct ProfileView: View {}}-+ private func loadTransferable(from imageSelection: PhotosPickerItem) {-+ Task {-+ do {-+ avatarImage = try await imageSelection.loadTransferable(type: AvatarImage.self)-+ } catch {-+ debugPrint(error)-+ }-+ }-+ }-+-+ private func downloadImage(path: String) async throws {-+ let data = try await supabase.storage.from("avatars").download(path: path)-+ avatarImage = AvatarImage(data: data)-+ }-+-+ private func uploadImage() async throws -> String? {-+ guard let data = avatarImage?.data else { return nil }-+-+ let filePath = "\(UUID().uuidString).jpeg"-+-+ try await supabase.storage-+ .from("avatars")-+ .upload(-+ filePath,-+ data: data,-+ options: FileOptions(contentType: "image/jpeg")-+ )-+-+ return filePath-+ }+ private func loadTransferable(from imageSelection: PhotosPickerItem) {+ Task {+ do {+ avatarImage = try await imageSelection.loadTransferable(type: AvatarImage.self)+ } catch {+ debugPrint(error)+ }+ }+ }++ private func downloadImage(path: String) async throws {+ let data = try await supabase.storage.from("avatars").download(path: path)+ avatarImage = AvatarImage(data: data)+ }++ private func uploadImage() async throws -> String? {+ guard let data = avatarImage?.data else { return nil }++ let filePath = "\(UUID().uuidString).jpeg"++ try await supabase.storage+ .from("avatars")+ .upload(+ filePath,+ data: data,+ options: FileOptions(contentType: "image/jpeg")+ )++ return filePath+ }}```