Re: Best way to have KVC-compliant enum property in Swift 2?

2015-07-29 Thread Rick Mann
On Jul 28, 2015, at 19:38 , Quincey Morris quinceymor...@rivergatesoftware.com wrote: I suspect that downloadState will never need to be set via KVC**, or from Obj-C code, in which case there’s a slightly simpler solution than Charles’ suggestion. You can have 2 properties, one of which

Re: Best way to have KVC-compliant enum property in Swift 2?

2015-07-28 Thread Charles Srstka
On Jul 28, 2015, at 8:07 PM, Rick Mann rm...@latencyzero.com wrote: I'd like to have a Swift enum that lays out a set of states, and a property of that type on an object that is KVObservable (i.e. dynamic). I don't think this is possible. What I settled on was this: class Model :

Re: Best way to have KVC-compliant enum property in Swift 2?

2015-07-28 Thread Quincey Morris
On Jul 28, 2015, at 18:07 , Rick Mann rm...@latencyzero.com wrote: dynamic var thumbnailURL: NSURL? dynamic var numFiles: NSNumber? dynamic var filesDownloaded : NSNumber? dynamic var downloadState : NSNumber? =

Best way to have KVC-compliant enum property in Swift 2?

2015-07-28 Thread Rick Mann
I'd like to have a Swift enum that lays out a set of states, and a property of that type on an object that is KVObservable (i.e. dynamic). I don't think this is possible. What I settled on was this: class Model : MPObject { enum DownloadState : NSNumber { case notDownloaded

Re: Best way to have KVC-compliant enum property in Swift 2?

2015-07-28 Thread Charles Srstka
On Jul 28, 2015, at 8:57 PM, Charles Srstka cocoa...@charlessoft.com wrote: func valueForKey(key: String) - AnyObject? { func setValue(value: AnyObject?, forKey key: String) { D’oh — I forgot to put “override” in front of these. Old Objective-C habits die hard. Sorry about