Skip to content

Commit

Permalink
fix: add init with default options param (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
grdsdev authored Jan 25, 2024
1 parent 148e3dc commit d148faa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Sources/Supabase/SupabaseClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ public final class SupabaseClient: @unchecked Sendable {
options.global.session
}

#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.
public convenience init(supabaseURL: URL, supabaseKey: String) {
self.init(
supabaseURL: supabaseURL,
supabaseKey: supabaseKey,
options: SupabaseClientOptions()
)
}
#endif

/// Create a new client.
/// - Parameters:
/// - supabaseURL: The unique Supabase URL which is supplied when you create a new project in
Expand Down
9 changes: 9 additions & 0 deletions Tests/SupabaseTests/SupabaseClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,13 @@ final class SupabaseClientTests: XCTestCase {
]
)
}

#if !os(Linux)
func testClientInitWithDefaultOptionsShouldBeAvailableInNonLinux() {
_ = SupabaseClient(
supabaseURL: URL(string: "https://project-ref.supabase.co")!,
supabaseKey: "ANON_KEY"
)
}
#endif
}

0 comments on commit d148faa

Please sign in to comment.