A Swift Package that wraps up a CoreData container for persisting user's notifications
ZeplinPersistence is the data layer for the Zeplin Mobile app. It handles storing notifications using CoreData and manages authentication tokens through the iOS keychain. The package uses app groups to share data between the main app and extensions like widgets or notification extensions.
The PersistenceController sets up a CoreData stack that can work with shared containers or in-memory stores for testing. The TokenRepository is an actor that safely manages OAuth tokens, handling refreshes and waiting for the device to unlock before accessing the keychain.
For more information visit Documentation.
Add ZeplinPersistence to your project using Swift Package Manager. In Xcode, go to File → Add Package Dependencies and enter the repository URL, or add it to your Package.swift file.
dependencies: [
.package(url: "https://github.com/Snapp-Mobile/ZeplinPersistence.git", from: "0.1.0")
]Create a persistence controller for your app target. The controller handles setting up the CoreData stack with the appropriate app group identifier.
import ZeplinPersistence
let persistence = PersistenceController(target: .iOSApp, inMemory: false)
let context = persistence.container.viewContextFor testing, use the built-in test controller that creates an in-memory store.
let testPersistence = PersistenceController.testThe token repository manages authentication tokens across your app. Initialize it with your keychain settings and app target.
let tokenRepo = TokenRepository(
key: "auth-token",
serviceName: "com.snapp.zeplin",
appTarget: .iOSApp,
configuration: apiConfig
)ZeplinPersistence is available under the MIT license. See the LICENSE file for details.
