Skip to content

Commit 0c15316

Browse files
committed
feat: re-add supabase init with a URL type
1 parent 80cd6e8 commit 0c15316

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

Sources/Supabase/SupabaseClient.swift

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,10 @@ public final class SupabaseClient: @unchecked Sendable {
6464
/// your project dashboard.
6565
/// - options: Custom options to configure client's behavior.
6666
public init(
67-
supabaseURL: String,
67+
supabaseURL: URL,
6868
supabaseKey: String,
6969
options: SupabaseClientOptions = .init()
7070
) {
71-
guard let supabaseURL = URL(string: supabaseURL) else {
72-
fatalError("Invalid supabaseURL: \(supabaseURL)")
73-
}
74-
7571
self.supabaseURL = supabaseURL
7672
self.supabaseKey = supabaseKey
7773
self.options = options
@@ -106,6 +102,25 @@ public final class SupabaseClient: @unchecked Sendable {
106102
listenForAuthEvents()
107103
}
108104

105+
/// Create a new client.
106+
/// - Parameters:
107+
/// - supabaseURL: The unique Supabase URL which is supplied when you create a new project in
108+
/// your project dashboard.
109+
/// - supabaseKey: The unique Supabase Key which is supplied when you create a new project in
110+
/// your project dashboard.
111+
/// - options: Custom options to configure client's behavior.
112+
public convenience init(
113+
supabaseURL: String,
114+
supabaseKey: String,
115+
options: SupabaseClientOptions = .init()
116+
) {
117+
guard let supabaseURL = URL(string: supabaseURL) else {
118+
fatalError("Invalid supabaseURL: \(supabaseURL)")
119+
}
120+
121+
self.init(supabaseURL: supabaseURL, supabaseKey: supabaseKey, options: options)
122+
}
123+
109124
deinit {
110125
listenForAuthEventsTask.value?.cancel()
111126
}

0 commit comments

Comments
 (0)