Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Int value properties for NSNumbers, in Swift #326

Closed
fraserscottmorrison opened this issue Apr 7, 2016 · 2 comments
Closed

Int value properties for NSNumbers, in Swift #326

fraserscottmorrison opened this issue Apr 7, 2016 · 2 comments

Comments

@fraserscottmorrison
Copy link

Feature Request

One thing I love about Mogenerator for ObjC is the auto generated primitive properties that unwrap NSNumbers

Are you planning on doing this for Swift? Ive started doing the following in the 'human' classes, but it'd be great to have it automatically built into the machine classes

    var identifierValue: Int? {
        get {
            if let identifier = self.identifier as NSNumber? {
                return identifier.integerValue
            }
            else {
                return nil
            }
        }
        set {
            if let intVal = newValue as Int? {
                self.identifier = NSNumber(int: Int32(intVal))
            }
            else {
                self.identifier = nil
            }
        }
    }
@justin
Copy link
Collaborator

justin commented Apr 7, 2016

See ticket #302 for a bit of discussion on this. I have been a bit stuck with other responsibilities to deal with it lately, but we're trying to find a way to make mogen a better Swift player.

@justin justin closed this as completed Apr 7, 2016
@fraserscottmorrison
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants