Skip to content

Commit

Permalink
Give linux a convenience init so tests can use it
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmichel committed Dec 17, 2023
1 parent bb4f4da commit 79da847
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Sources/Supabase/SupabaseClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public final class SupabaseClient: @unchecked Sendable {
#endif

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

#if os(Linux)
/// 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
) {
guard let supabaseURL = URL(string: supabaseURL) else {
fatalError("Invalid supabaseURL: \(supabaseURL)")
}

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

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

0 comments on commit 79da847

Please sign in to comment.