Git Product home page Git Product logo

Comments (2)

keith avatar keith commented on August 25, 2024

Up to this point we've thought immutable properties as a huge advantage of using mapper. The other problem with this plan is the limitation on optional protocol methods. We definitely don't want to require Mappable types to be limited to those inheriting from NSObject, or in general touching the Objective-C runtime. Unless we had some very compelling reasons to add this I would prefer this be an extension/new protocol specific to your use case.

from mapper.

keith avatar keith commented on August 25, 2024

As another thought on this. If you'd like that functionality where the majority of your properties will end up as var, you could implement a library that worked that way with a protocol that looked something like this:

protocol Mappable {
    init()
    func map(map: Mapper)
}

Then you could always use this map function to "fill" your objects. Before we switched to this library our internal library actually did that. I did a talk on mapper where I showed some examples of what that looked like if you're interested: https://realm.io/news/slug-keith-smiley-embrace-immutability/

from mapper.

Related Issues (20)

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.