Skip to content

Commit 79da847

Browse files
committed
Give linux a convenience init so tests can use it
1 parent bb4f4da commit 79da847

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

Sources/Supabase/SupabaseClient.swift

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public final class SupabaseClient: @unchecked Sendable {
128128
#endif
129129

130130
#if os(Windows)
131-
/// Create a new client.
131+
/// Create a new client.
132132
/// - Parameters:
133133
/// - supabaseURL: The unique Supabase URL which is supplied when you create a new project in
134134
/// your project dashboard.
@@ -148,6 +148,27 @@ public final class SupabaseClient: @unchecked Sendable {
148148
}
149149
#endif
150150

151+
#if os(Linux)
152+
/// Create a new client.
153+
/// - Parameters:
154+
/// - supabaseURL: The unique Supabase URL which is supplied when you create a new project in
155+
/// your project dashboard.
156+
/// - supabaseKey: The unique Supabase Key which is supplied when you create a new project in
157+
/// your project dashboard.
158+
/// - options: Custom options to configure client's behavior.
159+
public convenience init(
160+
supabaseURL: String,
161+
supabaseKey: String,
162+
options: SupabaseClientOptions
163+
) {
164+
guard let supabaseURL = URL(string: supabaseURL) else {
165+
fatalError("Invalid supabaseURL: \(supabaseURL)")
166+
}
167+
168+
self.init(supabaseURL: supabaseURL, supabaseKey: supabaseKey, options: options)
169+
}
170+
#endif
171+
151172
deinit {
152173
listenForAuthEventsTask.value?.cancel()
153174
}

0 commit comments

Comments
 (0)