Skip to content
This repository has been archived by the owner on Oct 15, 2021. It is now read-only.

futuredapp/Realm-Codegen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Realm Codegen

Sourcery template for Code Generation of Realm model files.

Currently a proof of concept, more work and testing on real-world project to come.

How to use

Annotate a struct as RealmPersistable and template will generate Realm model and methods to convert the struct to Realm model and back.

Example

//sourcery: RealmPersistable
struct Order {
    enum Status: String {
        case open = "OPEN"
        case completed = "COMPLETED"
    }

    //sourcery: RealmPersistable
    struct Item {
        let name: String
        let description: String?
        let price: Double
    }

    //sourcery: id
    let uid: String
    let status: Status
    let items: [Item]
}

About

Code Generation of Realm model files in Swift using Sourcery

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages