Swift: Upload to a signed URL

Upload a file to a bucket using a signed URL.

Examples

Upload to signed URL

let fileData = "Hello World".data(using: .utf8)!

try await supabase.storage
  .from("avatars")
  .uploadToSignedURL(
    "folder/avatar1.png",
    token: "your-signed-token",
    data: fileData,
    options: FileOptions(
      contentType: "text/plain"
    )
  )

Upload file from URL to signed URL

let fileURL = URL(fileURLWithPath: "/path/to/file.txt")

try await supabase.storage
  .from("avatars")
  .uploadToSignedURL(
    "folder/avatar1.png",
    token: "your-signed-token",
    fileURL: fileURL,
    options: FileOptions(
      contentType: "text/plain"
    )
  )