Classes

The following classes are available globally.

  • 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.

    • Tag: Amplify
    See more

    Declaration

    Swift

    public class Amplify : @unchecked Sendable
    extension Amplify: DefaultLogger
  • The API category provides a solution for making HTTP requests to REST and GraphQL endpoints.

    Note

    @unchecked Sendable to satisfy the Sendable requirement that the category behavior protocol now carries.

    Unchecked in the literal sense: plugins and isConfigured are plain mutable state with no lock, and isConfigured is public, so callers can flip it. add(plugin:) cannot race a configured category — it throws once isConfigured is set — but removePlugin(for:) has no such guard, so it can race a concurrent read. The exposure predates this annotation, which only stops the compiler from asking about it.

    See more

    Declaration

    Swift

    public final class APICategory : Category, @unchecked Sendable
    extension APICategory: DefaultLogger
    extension APICategory: APICategoryAuthProviderFactoryBehavior
    extension APICategory: APICategoryGraphQLBehavior
    extension APICategory: APICategoryInterceptorBehavior
    extension APICategory: APICategoryRESTBehavior
    extension APICategory: APICategoryReachabilityBehavior
    extension APICategory: Resettable
  • API Auth Provider Factory

    See more

    Declaration

    Swift

    open class APIAuthProviderFactory
  • GraphQL Subscription Operation

    See more

    Declaration

    Swift

    open class GraphQLSubscriptionOperation<R: Decodable>: AmplifyInProcessReportingOperation<
        GraphQLOperationRequest<R>,
        GraphQLSubscriptionEvent<R>,
        Void,
        APIError
    >, @unchecked Sendable
  • GraphQL Operation

    See more

    Declaration

    Swift

    open class GraphQLOperation<R: Decodable>: AmplifyOperation<
        GraphQLOperationRequest<R>,
        GraphQLResponse<R>,
        APIError
    >, @unchecked Sendable

RetryableGraphQLOperation

  • Declaration

    Swift

    public final class RetryableGraphQLOperation<Payload> where Payload : Decodable, Payload : Sendable
  • Note

    @unchecked Sendable because _task is mutable but every access is serialized by lock.
    See more

    Declaration

    Swift

    public final class RetryableGraphQLSubscriptionOperation<Payload>: @unchecked Sendable
        where Payload: Decodable, Payload: Sendable
  • REST Request

    See more

    Declaration

    Swift

    public class RESTRequest
  • The Analytics category enables you to collect analytics data for your app.

    See more

    Declaration

    Swift

    public final class AnalyticsCategory : Category
    extension AnalyticsCategory: AnalyticsCategoryBehavior
    extension AnalyticsCategory: DefaultLogger
    extension AnalyticsCategory: Resettable
  • Note

    @unchecked Sendable to satisfy the Sendable requirement that the category behavior protocol now carries.

    Unchecked in the literal sense: plugins and isConfigured are plain mutable state with no lock. add(plugin:) cannot race a configured category — it throws once isConfigured is set — but removePlugin(for:) mutates plugins with no such guard and no lock, so it can race a concurrent read. That exposure predates this annotation; the annotation only stops the compiler from asking about it.

    See more

    Declaration

    Swift

    public final class AuthCategory : Category, @unchecked Sendable
    extension AuthCategory: AuthCategoryBehavior
    extension AuthCategory: AuthCategoryDeviceBehavior
    extension AuthCategory: AuthCategoryUserBehavior
    extension AuthCategory: AuthCategoryWebAuthnBehaviour
    extension AuthCategory: DefaultLogger
    extension AuthCategory: Resettable
  • Declaration

    Swift

    public final class DataStoreCategory : Category
    extension DataStoreCategory: DataStoreBaseBehavior
    extension DataStoreCategory: DefaultLogger
    extension DataStoreCategory: Resettable
    extension DataStoreCategory: DataStoreSubscribeBehavior
  • This class represents a lazy reference to a Model, meaning that the reference may or may not exist at instantiation time.

    The default implementation DefaultModelProvider only handles in-memory data, therefore get() and require() will simply return the current reference.

    Note

    @unchecked Sendable for the same reason, and with the same caveat, as List: the lazy-load transition on loadedState is not synchronized.
    See more

    Declaration

    Swift

    public class LazyReference<ModelType> : Codable, _LazyReferenceValue, @unchecked Sendable where ModelType : Model
  • List<ModelType> is a custom Collection that is capable of loading records from a data source. This is especially useful when dealing with Model associations that need to be lazy loaded. Lazy loading is performed when you access the Collection methods by retrieving the data from the underlying data source and then stored into this object, before returning the data to you. Consumers must be aware that multiple calls to the data source and then stored into this object will happen simultaneously if the object is used from different threads, thus not thread safe. Lazy loading is idempotent and will return the stored results on subsequent access.

    Note

    @unchecked Sendable because Model is Sendable and codegen’d models store List properties, so this has to be Sendable for them to compile.

    Be aware this is an assertion, not a proof: loadedState is mutated on first load and is not synchronized, so two concurrent load() calls can both fetch. That race predates this migration; making it genuinely safe means putting the lazy-load transition behind a lock, which touches the Collection and Codable surface and is better done on its own.

    See more

    Declaration

    Swift

    public class List<ModelType> : Collection, Codable, ExpressibleByArrayLiteral, ModelListMarker, @unchecked Sendable where ModelType : Model
  • Represents the Model structure itself, a container of property references.

    • Example: “`swift class PostModelPath : ModelPath {}

    extension ModelPath where ModelType == Post { var id: FieldPath { id() } var title: FieldPath { string("title”) } var blog: ModelPath { BlogModelPath(name: “blog”, parent: self) } }

    See more

    Declaration

    Swift

    open class ModelPath<ModelType> : PropertyContainerPath where ModelType : Model
  • Note

    @unchecked Sendable rather than final, for the same reason as QueryPredicateGroup. Both stored properties are immutable.
    See more

    Declaration

    Swift

    public class QueryPredicateOperation : QueryPredicate, Encodable, @unchecked Sendable
    extension QueryPredicateOperation: Equatable
  • Note

    @unchecked Sendable, and not final, so that anyone who subclassed this keeps compiling.

    The conformance is a genuine assertion, not a checked fact. and(_:) and or(_:) mutate predicates in place and return self when the group type already matches, so two tasks composing onto the same group race on an array — and predicates is public internal(set), so external code reads it directly and a lock here would not cover those reads without turning it into a computed property.

    What makes this safe in practice is usage, not structure: a predicate is built up on one task and then handed to a query. Sharing a part-built group across tasks is unsupported, and nothing in the type enforces that. The exposure predates this annotation, which only stops the compiler asking.

    See more

    Declaration

    Swift

    public class QueryPredicateGroup : QueryPredicate, Encodable, @unchecked Sendable
    extension QueryPredicateGroup: Equatable
  • The Geo category enables you to interact with geospacial services.

    See more

    Declaration

    Swift

    public final class GeoCategory : Category
    extension GeoCategory: GeoCategoryBehavior
    extension GeoCategory: DefaultLogger
    extension GeoCategory: Resettable
  • Amplify has a local eventing system called Hub. It is a lightweight implementation of Publisher-Subscriber pattern, and is used to share data between modules and components in your app. Hub enables different categories to communicate with one another when specific events occur, such as authentication events like a user sign-in or notification of a file download.

    See more

    Declaration

    Swift

    public final class HubCategory : Category
    extension HubCategory: HubCategoryBehavior
    extension HubCategory: DefaultLogger
    extension HubCategory: Resettable
  • AWS Amplify writes console logs through Logger. You can use Logger in your apps for the same purpose.

    Note

    @unchecked Sendable. The lock does not cover everything: only _logLevel goes through it. configurationState and plugins are plain mutable state, written by add(plugin:) and removePlugin(for:) after initialization, and read without the lock. So the locking discipline here is partial rather than complete.

    In practice configuration happens once during start-up and the state is read-only afterwards, but nothing in this type enforces that. Bringing those two under the same lock would be the real fix and is worth doing separately — it needs care, because several accessors call each other and would deadlock on a non-recursive lock.

    See more

    Declaration

    Swift

    public final class LoggingCategory : Category, @unchecked Sendable
    extension LoggingCategory: Resettable
    extension LoggingCategory: LoggingCategoryClientBehavior
    extension LoggingCategory: Logger
    extension LoggingCategory: DefaultLogger
  • The Notifications parent category

    See more

    Declaration

    Swift

    public final class NotificationsCategory
  • The Push Notifications category allows you to receive and report push notifications.

    See more

    Declaration

    Swift

    public final class PushNotificationsCategory : Category
    extension PushNotificationsCategory: Resettable
    extension PushNotificationsCategory: PushNotificationsCategoryBehaviour
    extension PushNotificationsCategory: DefaultLogger
  • Declaration

    Swift

    public final class PredictionsCategory : Category
    extension PredictionsCategory: Resettable
    extension PredictionsCategory: PredictionsCategoryBehavior
    extension PredictionsCategory: DefaultLogger
  • AWS Amplify Storage module provides a simple mechanism for managing user content for your app in public, protected or private storage buckets.

    • Tag: StorageCategory
    See more

    Declaration

    Swift

    public final class StorageCategory : Category
    extension StorageCategory: Resettable
    extension StorageCategory: StorageCategoryBehavior
    extension StorageCategory: DefaultLogger
  • Note

    @unchecked Sendable because parent and isCancelled are mutable but every access is serialized by lock. The compiler cannot verify that, so the guarantee is asserted here and enforced by the accessors below.
    See more

    Declaration

    Swift

    public class AmplifyAsyncSequence<Element> : AsyncSequence, Cancellable, @unchecked Sendable where Element : Sendable
  • Note

    @unchecked Sendable for the same reason as AmplifyAsyncSequence: _parent and _isCancelled are mutable but every access is serialized by lock.
    See more

    Declaration

    Swift

    public class AmplifyAsyncThrowingSequence<Element> : AsyncSequence, Cancellable, @unchecked Sendable where Element : Sendable
  • An AmplifyOperation that emits InProcess values intermittently during the operation.

    Unlike a regular AmplifyOperation, which emits a single Result at the completion of the operation’s work, an AmplifyInProcessReportingOperation may emit intermediate values while its work is ongoing. These values could be incidental to the operation (such as a Storage.downloadFile operation reporting Progress values periodically as the download proceeds), or they could be the primary delivery mechanism for an operation (such as a GraphQLSubscriptionOperation‘s emitting new subscription values).

    See more

    Declaration

    Swift

    open class AmplifyInProcessReportingOperation<
        Request: AmplifyOperationRequest,
        InProcess,
        Success,
        Failure: AmplifyError
    >: AmplifyOperation<Request, Success, Failure>, @unchecked Sendable
  • An abstract representation of an Amplify unit of work. Subclasses may aggregate multiple work items to fulfull a single “AmplifyOperation”, such as an “extract text operation” which might include uploading an image to cloud storage, processing it via a Predictions engine, and translating the results.

    AmplifyOperations are used by plugin developers to perform tasks on behalf of the calling app. They have a default implementation of a dispatch method that sends a contextualized payload to the Hub.

    Pausable/resumable tasks that do not require Hub dispatching should use AsynchronousOperation instead.

    See more

    Declaration

    Swift

    open class AmplifyOperation<Request, Success, Failure> : AsynchronousOperation, @unchecked Sendable where Request : AmplifyOperationRequest, Failure : AmplifyError
    extension AmplifyOperation: CategoryTypeable
    extension AmplifyOperation: HubPayloadEventNameable
    extension AmplifyOperation: Cancellable
  • Declaration

    Swift

    public class AmplifyOperationTaskAdapter<
        Request: AmplifyOperationRequest,
        Success: Sendable,
        Failure: AmplifyError
    >: AmplifyTask, @unchecked Sendable
  • Declaration

    Swift

    public class AmplifyInProcessReportingOperationTaskAdapter<
        Request: AmplifyOperationRequest,
        InProcess: Sendable,
        Success: Sendable,
        Failure: AmplifyError
    >: AmplifyTask, AmplifyInProcessReportingTask, @unchecked Sendable
  • This class is to facilitate executing asychronous requests. The caller can transition the operation to its finished state by calling finish() in the callback of an asychronous request to ensure that the operation is only removed from the OperationQueue after it has completed all its work. This class is not inherently thread safe. Although it is a subclass of Foundation’s Operation, it contains private state to support pausing, resuming, and finishing, that must be managed by callers.

    See more

    Declaration

    Swift

    open class AsynchronousOperation : Operation, @unchecked Sendable
  • Note

    @unchecked Sendable because value is mutable but every access below is serialized by lock. Key/Value are deliberately unconstrained so existing callers keep working; as before, whether the elements are safe to use across domains remains the caller’s concern.
    See more

    Declaration

    Swift

    public final class AtomicDictionary<Key, Value> : @unchecked Sendable where Key : Hashable
    extension AtomicDictionary: ExpressibleByDictionaryLiteral
    extension AtomicDictionary: Sequence
  • A class that wraps access to its underlying value with an NSLocking instance.

    See more

    Declaration

    Swift

    public final class AtomicValue<Value> : @unchecked Sendable
  • A helper for executing asynchronous work serially.

    Note

    Sendable because the only stored property is a let AsyncStream.Continuation, which is itself thread-safe.
    See more

    Declaration

    Swift

    public final class TaskQueue<Success> : Sendable
  • A Tree data type with a value of some type E and children subtrees.

    See more

    Declaration

    Swift

    public class Tree<E>
  • Declaration

    Swift

    public class WeakRef<T> where T : AnyObject
  • The default Hub plugin provided with the Amplify Framework

    No guaranteed delivery order

    AWSHubPlugin distributes messages in order to listeners, but makes no guarantees about the order in which a listener is called. This plugin does not guarantee synchronization between message delivery and listener management. In other words, the following sequence is not guaranteed to succeed:

    plugin.listen(to: .custom("MyChannel") { event in print("event received: \(event)") }
    plugin.dispatch(to: .custom("MyChannel"), payload: HubPayload("MY_EVENT"))
    

    Instead, messages and listener states are guaranteed to be independently self-consistent. Callers can use hasListener(withToken:) to check that a listener has been registered.

    See more

    Declaration

    Swift

    public final class AWSHubPlugin : HubCategoryPlugin
    extension AWSHubPlugin: AmplifyVersionable
  • A Logging category plugin that forwards calls to the OS’s Unified Logging system

    Note

    @unchecked Sendable to satisfy the Sendable requirement on Plugin. registeredLogs is guarded, but inconsistently — concurrencyQueue on the caching and reset paths, lock in enable()/disable() — and enabled is not guarded at all. That predates the Swift 6 migration and is left as-is here rather than changed blind: enabled is read from inside lock.execute, so backing it with the same non-recursive lock would deadlock. Worth untangling separately.
    See more

    Declaration

    Swift

    public final class AWSUnifiedLoggingPlugin : LoggingCategoryPlugin, @unchecked Sendable
    extension AWSUnifiedLoggingPlugin: AmplifyVersionable
  • Presents a developer menu using the provided DevMenuPresentationContextProvider upon notification from a TriggerRecognizer. Default recognizer is a LongPressGestureRecognizer

    See more
  • LoggingCategoryPlugin that wraps anotherLoggingCategoryPlugin and saves the logs in memory

    Note

    @unchecked Sendable because Plugin is Sendable and the lazily-created wrapper is mutable state; lock guards it. Deliberately not final — this type is public API, and @unchecked Sendable does not require final, so marking it so would needlessly break any subclass.
    See more