Interacting with Stitch
The Stitch utility class and the rest of the protocols here provide functionality for interacting with a MongoDB Stitch application. None of these classes or protocols are meant to be instantiated directly. All interaction with Stitch begins at the level of the Stitch utility class.
-
Stitchis the singleton class with static utility functions for initializing the SDK.Use it to initialize and retrieve a
See moreStitchAppClientfor your Stitch app.Declaration
Swift
public class Stitch
-
The
StitchAppClienthas the fundamental set of methods for communicating with a MongoDB Stitch application backend.An implementation can be initialized or retrieved using the
Stitchutility class.This protocol provides access to the
StitchAuthfor login and authentication.Using
serviceClient, you can retrieve services, including theRemoteMongoClientfor reading and writing on the database. To create aRemoteMongoClient, passremoteMongoClientFactoryintoserviceClient(fromFactory:withName).You can also use it to execute Stitch Functions.
Finally, its
See moreStitchPushobject can register the current user for push notifications.Declaration
Swift
public protocol StitchAppClient
-
The
StitchAuthprovides methods for retrieving or modifying the authentication state of aStitchAppClient.Each
StitchAppClienthas an instance of StitchAuth.Information about the logged-in
StitchUseris available in thecurrentUserproperty.To watch for auth events, add a
See moreStitchAuthDelegate.Declaration
Swift
public protocol StitchAuth
-
StitchAuthDelegateis a protocol to be inherited when you need to take action on authentication events. An instance of aStitchAuthDelegatemust be added to aStitchAuth.See moreNote
This protocol uses an extension to provide default implementations. This is for your convenience, so you do not have to implement every method here to satisfy the protocol requirements. This however does mean that if you plan on subclassing your implementation of
StitchAuthDelegate, you may run into unexpected issues where the empty default implementation is called instead of your subclass implementation. If this does happen in your code, see this article for more context and potential workarounds, or open an issue in our GitHub repository.- Tag: StitchAuthDelegate
Declaration
Swift
public protocol StitchAuthDelegate : AnyObject
-
StitchPush can be used to get clients that can register for push notifications via Stitch.
See moreDeclaration
Swift
public protocol StitchPush
-
StitchServiceClient acts as a general purpose client for working with services that are not defined or well defined by this SDK. It has methods similar to the
See morecallFunctionmethod onStitchAppClient.Declaration
Swift
public protocol StitchServiceClient
-
The
StitchUserrepresents the the user who is logged in to theStitchAppClient.You can retrieve an instance from
StitchAuthor from theStitchResultof certain methods.You will find information about the user such as name and email address in the
StitchUserProfilepropertyprofile.See moreSee also
StitchAuthDeclaration
Swift
public protocol StitchUser : CoreStitchUser
-
The StitchUserProfile describes a
StitchUser.Every
StitchUserhas aStitchUserProfilemember.See
See moreExtendedStitchUserProfilefor additional fields available on this type.Declaration
Swift
public protocol StitchUserProfile : ExtendedStitchUserProfile
-
The
See moreStitchUserIdentityrepresents an identity that aStitchUseris linked to and can use to log in to their account.Declaration
Swift
public protocol StitchUserIdentity : Decodable, Encodable
-
StitchResultholds the result to an asynchronous operation performed against the Stitch server.When an operation completes successfully, the
See moreStitchResultholds the result of the operation. When the operation fails, theStitchResultcontains aStitchErrorobject describing the reason for the failure.Declaration
Swift
public enum StitchResult<T>
Interacting with Stitch Reference