Giter VIP home page Giter VIP logo

cloudkitcodable's People

Contributors

insidegui avatar tonyarnold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudkitcodable's Issues

Custom keys

Is it possible to add support for custom keys? In CloudKit I have a property like "archived" but I'd want to define it as let isArchived: Bool

Support nested values

As mentioned on the readme, nested values are not supported yet. They would have to be encoded as CKReference.

Expose mechanism for viewing system fields

Hey Gui,

It would be great to have access to the system fields typed data of the CKRecord to provide the capability to the following workflows:

  1. Inspect recordChangeTag to detect conflicts before executing an CKModifyRecordsOperation
  2. Inspect the creatorUserRecordID for presentation to the user or logic purposes
    Example: owner can update, but enforce this client side--not by using security role
  3. Inspect modificationDate for display or logic purposes
  4. Etc for other system fields

Do you think this would compliment your library? I assume the above use cases would be commonly desired. Here is some quick and dirty on what I was thinking.

public struct CloudKitRecordSystemFields {
    
    private let metaRecord: CKRecord

    public var recordID: CKRecord.ID {
        metaRecord.recordID
    }
    
    public var recordType: CKRecord.RecordType {
        metaRecord.recordType
    }
    
    public var creationDate: Date? {
        metaRecord.creationDate
    }
    
    public var creatorUserRecordID: CKRecord.ID? {
        metaRecord.creatorUserRecordID
    }
    
    public var modificationDate: Date? {
        metaRecord.modificationDate
    }
    
    public var lastModifiedUserRecordID: CKRecord.ID? {
        metaRecord.lastModifiedUserRecordID
    }
    
    public var recordChangeTag: String? {
        metaRecord.recordChangeTag
    }
    
    public init(record: CKRecord) {
        self.metaRecord = record
    }
}

extension CloudKitRecordSystemFields {

    // Discussion: Static factory, convenience initializers, or both?
    
    public init(coder: NSCoder) {
        guard let metaRecord = CKRecord(coder: coder) else {
            // NOTE: Might have to use generics to infer recordType if coder initializer of the metaRecord fails if returning a default value instead of throw or nil
            fatalError()
        }
        
        self.metaRecord = metaRecord
    }
    
    public static from(coder: NSCoder) -> CloudKitRecordSystemFields {
        // TODO: Implement this signature
        fatalError()
    }
    
    public init(data: Data) {
        // TODO: Implement this signature
        fatalError()
    }
    
    public static func from(data: Data) -> CloudKitRecordSystemFields {
        // TODO: Implement this signature
        fatalError()
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.