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 (likeAnalytics.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.
-
Declaration
Swift
public internal(set) static var Analytics: AnalyticsCategory { get }
-
Declaration
Swift
public internal(set) static var API: APICategory { get }
-
Declaration
Swift
public internal(set) static var Auth: AuthCategory { get }
-
Declaration
Swift
public internal(set) static var DataStore: DataStoreCategory { get }
-
Declaration
Swift
public internal(set) static var Geo: GeoCategory { get }
-
Declaration
Swift
public internal(set) static var Hub: HubCategory { get }
-
Declaration
Swift
public internal(set) static var Predictions: PredictionsCategory { get }
-
Declaration
Swift
public internal(set) static var Storage: StorageCategory { get }
-
Declaration
Swift
public internal(set) static var Logging: LoggingCategory { get set }
-
Adds
plugin
to the categoryDeclaration
Swift
public static func add<P>(plugin: P) throws where P : Plugin
Parameters
plugin
The plugin to add
-
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)