You can initialize Supabase with the SupabaseClient by passing your Project URL and Project Key. You can find these under your Project Settings → API Settings The Supabase client is your entrypoint to the rest of the Supabase functionality and is the easiest way to interact with everything we offer within the Supabase ecosystem.
import Supabase
let client = SupabaseClient(supabaseURL: URL(string: "https://xyzcompany.supabase.co")!, supabaseKey: "publishable-or-anon-key")
import Supabase
let supabase = SupabaseClient(
supabaseURL: URL(string: "https://xyzcompany.supabase.co")!,
supabaseKey: "publishable-or-anon-key",
options: SupabaseClientOptions(
db: .init(
schema: "public"
),
auth: .init(
storage: MyCustomLocalStorage(),
flowType: .pkce
),
global: .init(
headers: ["x-my-custom-header": "my-app-name"],
session: URLSession.myCustomSession
)
)
)
import Supabase
struct AppLogger: SupabaseLogger {
func log(message: SupabaseLogMessage) {
print(message.description)
}
}
let supabase = SupabaseClient(
supabaseURL: URL(string: "https://xyzcompany.supabase.co")!,
supabaseKey: "publishable-or-anon-key",
options: SupabaseClientOptions(
global: SupabaseClientOptions.GlobalOptions(
logger: AppLogger()
)
)
)
import Supabase
let supabase = SupabaseClient(
supabaseURL: URL(string: "https://xyzcompany.supabase.co")!,
supabaseKey: "publishable-or-anon-key",
options: SupabaseClientOptions(
db: .init(
// Provide a custom schema. Defaults to "public".
schema: "other_schema"
)
)
)