Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapty+Activate: Improve documentation #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions Sources/Adapty+Activate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ import Foundation
private let log = Log.default

extension Adapty {
/// Use this method to initialize the Adapty SDK.
/// Use this method to initialize the Adapty SDK. It is the caller's responsibility to ensure that this method is
/// invoked only once. If and only if this requirement is violated, the method throws an appropriate error.
///
/// Call this method in the `application(_:didFinishLaunchingWithOptions:)`.
///
/// - Parameter apiKey: You can find it in your app settings in [Adapty Dashboard](https://app.adapty.io/) *App settings* > *General*.
/// - Parameter observerMode: A boolean value controlling [Observer mode](https://docs.adapty.io/v2.0.0/docs/observer-vs-full-mode). Turn it on if you handle purchases and subscription status yourself and use Adapty for sending subscription events and analytics
/// - Parameter customerUserId: User identifier in your system
///
/// - Throws: An `AdaptyError` instance indicating a violation of the requirement to invoke this method only once.
///
/// - important: This method is not thread-safe.
public nonisolated static func activate(
_ apiKey: String,
observerMode: Bool = false,
Expand All @@ -31,22 +36,32 @@ extension Adapty {
)
}

/// Use this method to initialize the Adapty SDK.
/// Use this method to initialize the Adapty SDK. It is the caller's responsibility to ensure that this method is
/// invoked only once. If and only if this requirement is violated, the method throws an appropriate error.
///
/// Call this method in the `application(_:didFinishLaunchingWithOptions:)`.
///
/// - Parameter builder: `AdaptyConfiguration.Builder` which allows to configure Adapty SDK
///
/// - Throws: An `AdaptyError` instance indicating a violation of the requirement to invoke this method only once.
///
/// - important: This method is not thread-safe.
public nonisolated static func activate(
with builder: AdaptyConfiguration.Builder
) async throws {
try await activate(with: builder.build())
}

/// Use this method to initialize the Adapty SDK.
/// Use this method to initialize the Adapty SDK. It is the caller's responsibility to ensure that this method is
/// invoked only once. If and only if this requirement is violated, the method throws an appropriate error.
///
/// Call this method in the `application(_:didFinishLaunchingWithOptions:)`.
///
/// - Parameter configuration: `AdaptyConfiguration` which allows to configure Adapty SDK
///
/// - Throws: An `AdaptyError` instance indicating a violation of the requirement to invoke this method only once.
///
/// - important: This method is not thread-safe.
public static func activate(
with configuration: AdaptyConfiguration
) async throws {
Expand Down