Swiftpack.co - eugene-software/EZADatabase as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by eugene-software.
eugene-software/EZADatabase 1.1.2
Convenient library to work with CoreData with Combine
⭐️ 1
🕓 5 weeks ago
.package(url: "https://github.com/eugene-software/EZADatabase.git", from: "1.1.2")


Version License Platform


  • iOS 13 and above

Usage Example

Import dependenices:

import Combine
import EZADatabase

In AppDelegate run setup method:

func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
            .openDatabase(in: application)
            .sink { _ in }
            .store(in: &cancellables)
    return true

Create CoreDataCompatible struct that reflects a CoreData model:

struct User: Codable, Hashable {
    var userId: String
    var userName: String

extension User: CoreDataCompatible {
    typealias ManagedType = CoreDataUser
    var primaryKey: Any {
        return userId
    var primaryKeyName: String {
        return "userId"
    init(managedObject: CoreDataUser) {
        userId = managedObject.userId
        userName = managedObject.userName

Create NSManagedObject subclass that conforms to CoreDataExportable and reflects a CoreDataCompatible model:

class CoreDataUser: NSManagedObject {

    @NSManaged var userId: String
    @NSManaged var userName: String

extension CoreDataUser : CoreDataExportable {
    typealias ExportType = User
    func configure(with object: User, in storage: EZADatabase.CoreDataStorageInterface) {
        userId = object.userId
        userName = object.userName
    func getObject() -> Device {
        User(managedObject: self)
  • To store an object:

let user = User(userId: "someId", userName: "John")

    .sink { completion in
    } receiveValue: { _ in
    .store(in: &cancellables)
  • To receive an object:

EZAReader.exportRemoteList(predicate: NSPredicate(key: "userId", value: "someId"))
    .sink { completion in
    } receiveValue: { user in
    .store(in: &cancellables)



EZADatabase is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'EZADatabase'

Swift Package Manager

  1. Right click in the Project Navigator
  2. Select "Add Packages..."
  3. Search for https://github.com/eugene-software/EZADatabase.git


Eugene Software


EZADatabase is available under the MIT license. See the LICENSE file for more info.


Stars: 1
Last commit: 5 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

5 weeks ago
  • implement Combine for create/delete database methods

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics