Amplify

public class Amplify
extension Amplify: DefaultLogger

At its core, the Amplify class is simply a router that provides clients top-level access to categories and configuration methods. It provides convenient access to default plugins via the top-level category properties, but clients can access specific plugins by invoking getPlugin on a category and issuing methods directly to that plugin.

Warning

It is a serious error to invoke any of the category APIs (like Analytics.record() or API.mutate()) without first registering plugins via Amplify.add(plugin:) and configuring Amplify via Amplify.configure(). Such access will cause a preconditionFailure.

There are two exceptions to this. The Logging and Hub categories are configured with a default plugin that is available at initialization.

Configure

  • Configures Amplify with the specified configuration.

    This method must be invoked after registering plugins, and before using any Amplify category. It must not be invoked more than once.

    Lifecycle

    Internally, Amplify configures the Hub and Logging categories first, so they are available to plugins in the remaining categories during the configuration phase. Plugins for the Hub and Logging categories must not assume that any other categories are available.

    After Amplify has configured all of its categories, it will dispatch a HubPayload.EventName.Amplify.configured event to each Amplify Hub channel. After this point, plugins may invoke calls on other Amplify categories.

    Declaration

    Swift

    public static func configure(_ configuration: AmplifyConfiguration? = nil) throws

    Parameters

    configuration

    The AmplifyConfiguration for specified Categories

  • Declaration

    Swift

    public static func enableDevMenu(contextProvider: DevMenuPresentationContextProvider)