Skip to content

Commit

Permalink
feat: re-add supabase init with a URL type
Browse files Browse the repository at this point in the history
  • Loading branch information
grdsdev committed Nov 21, 2023
1 parent 80cd6e8 commit 0c15316
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions Sources/Supabase/SupabaseClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,10 @@ public final class SupabaseClient: @unchecked Sendable {
/// your project dashboard.
/// - options: Custom options to configure client's behavior.
public init(
supabaseURL: String,
supabaseURL: URL,
supabaseKey: String,
options: SupabaseClientOptions = .init()
) {
guard let supabaseURL = URL(string: supabaseURL) else {
fatalError("Invalid supabaseURL: \(supabaseURL)")
}

self.supabaseURL = supabaseURL
self.supabaseKey = supabaseKey
self.options = options
Expand Down Expand Up @@ -106,6 +102,25 @@ public final class SupabaseClient: @unchecked Sendable {
listenForAuthEvents()
}

/// Create a new client.
/// - Parameters:
/// - supabaseURL: The unique Supabase URL which is supplied when you create a new project in
/// your project dashboard.
/// - supabaseKey: The unique Supabase Key which is supplied when you create a new project in
/// your project dashboard.
/// - options: Custom options to configure client's behavior.
public convenience init(
supabaseURL: String,
supabaseKey: String,
options: SupabaseClientOptions = .init()
) {
guard let supabaseURL = URL(string: supabaseURL) else {
fatalError("Invalid supabaseURL: \(supabaseURL)")
}

self.init(supabaseURL: supabaseURL, supabaseKey: supabaseKey, options: options)
}

deinit {
listenForAuthEventsTask.value?.cancel()
}
Expand Down

0 comments on commit 0c15316

Please sign in to comment.