To get started with Momento you will need a Momento API key. You can get one from the Momento Console.
- Website: https://www.gomomento.com/
- Momento Documentation: https://docs.momentohq.com/
- Getting Started: https://docs.momentohq.com/getting-started
- Discuss: Momento Discord
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"),
],
Check out our topics example directory for a complete example of using the Momento Swift SDK to implement a publish and subscribe system.
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!
Check out full working code in the topics example directory of this repository!
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.
If you are interested in contributing to the SDK, please see the CONTRIBUTING docs.
For more info, visit our website at https://gomomento.com!