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.
- Tag: Amplify
-
- Tag: Amplify.Analytics
Declaration
Swift
public internal(set) static var Analytics: AnalyticsCategory { get }
-
- Tag: Amplify.API
Declaration
Swift
public internal(set) static var API: APICategory { get }
-
- Tag: Amplify.Auth
Declaration
Swift
public internal(set) static var Auth: AuthCategory { get }
-
- Tag: Amplify.DataStore
Declaration
Swift
public internal(set) static var DataStore: DataStoreCategory { get }
-
- Tag: Amplify.Geo
Declaration
Swift
public internal(set) static var Geo: GeoCategory { get }
-
- Tag: Amplify.Hub
Declaration
Swift
public internal(set) static var Hub: HubCategory { get }
-
- Tag: Amplify.Notifications
Declaration
Swift
public internal(set) static var Notifications: NotificationsCategory { get }
-
- Tag: Amplify.Predictions
Declaration
Swift
public internal(set) static var Predictions: PredictionsCategory { get }
-
- Tag: Amplify.Storage
Declaration
Swift
public internal(set) static var Storage: StorageCategory { get }
-
Special case category. We protect this with an AtomicValue because it is used by reset() methods during setup & teardown of tests
- Tag: Amplify.Logging
Declaration
Swift
public internal(set) static var Logging: LoggingCategory { get set }
-
Declaration
Swift
public static func add<P>(plugin: P) throws where P : Plugin
Parameters
plugin
The plugin to add
-
Declaration
Swift
public static var log: Logger { get }
-
Declaration
Swift
public var log: Logger { get }
-
Declaration
Swift
enum LogLevel : Int, Codable
-
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.Tag: Amplify.configure
Declaration
Swift
public static func configure(_ configuration: AmplifyConfiguration? = nil) throws
Parameters
configuration
The AmplifyConfiguration for specified Categories
-
API to configure with Amplify CLI Gen2’s configuration.
Declaration
Swift
public static func configure(with amplifyOutputs: AmplifyOutputs) throws
Parameters
with
AmplifyOutputs
configuration resolver -
Get Combine Publishers for Amplify APIs.
Provides static methods to create Combine Publishers from Tasks and AsyncSequences.
These can be used to get Combine Publishers for any Amplify API.
See moreDeclaration
Swift
enum Publisher
-