/client-sdk-swift

Primary LanguageSwiftApache License 2.0Apache-2.0

logo

project status project stability

Momento Swift SDK

To get started with Momento you will need a Momento API key. You can get one from the Momento Console.

Packages

The Momento Swift SDK is available here on github: momentohq/client-sdk-swift. Add the following to the dependencies section of your Package.swift file to include the SDK in your project:

.package(url: "https://github.com/momentohq/client-sdk-swift", exact: "0.2.1")

Your target dependencies will refer to the Momento SDK like so:

dependencies: [
    .product(name: "momento", package: "client-sdk-swift"),
],

Usage

Check out our topics example directory for a complete example of using the Momento Swift SDK to implement a publish and subscribe system.

Getting Started and Documentation

General documentation on Momento and the Momento SDKs is available on the Momento Docs website. Specific usage examples for the Swift SDK will be available there as well soon!

Examples

Check out full working code in the topics example directory of this repository!

Logging

We are using swift-log to create internal Loggers for producing Momento-related logs. The default logging backend provided by swift-log (StreamLogHandler) simply prints to stdout at a default logging level of .info.

To change the logging level and/or redirect logs to stderr, you would call LoggingSystem.bootstrap(...) once at the beginning of your program like so:

LoggingSystem.bootstrap {
    var handler = StreamLogHandler.standardError(label: "momento-logger")
    handler.logLevel = .debug
    return handler
}

You can also use the LoggingSystem.bootstrap call to configure your preferred swift-log compatible logging backend or to use your custom logging backend implementation.

Developing

If you are interested in contributing to the SDK, please see the CONTRIBUTING docs.


For more info, visit our website at https://gomomento.com!