Secure coding NSArray

2016-02-14 Thread Quincey Morris
I might be late to this party, but since I just spent hours on it, I’ll document this for anyone who hasn’t run into it yet. If you’re using NSSecureCoding, there’s a problem decoding NSArray objects. You can’t use this: myArray = [coder decodeObjectForKey: @“myArray”]; and you can’t u

Swift bindings issue, Swift.Dictionary, NSMutableDictionary and NSObjectController

2016-02-14 Thread Samuel Williams
I have a .xib with a NSObjectController with it's content bound to a Swift [String : AnyObject] variable, but get the following error: *Cocoa Bindings: Error setting value for key path selection.startDate of object [object class: NSMutableDictionary] (from bound object ): [<_TtGCSs29_NativeDiction

Re: Deleting an file that's been NSData memory mapped - safe?

2016-02-14 Thread Marcel Weiher
> On 11 Feb 2016, at 20:44, Dan Lau wrote: > > If a file has its contents mapped using NSData's > initWithContentsOfFile + NSDataReadingMappedIfSafe, > deleting it doesn't appear to affect reading it's mapped contents. Does > anyone know if NSData uses mmap(2) under the hood to ensure that this

Re: Deleting an file that's been NSData memory mapped - safe?

2016-02-14 Thread dangerwillrobinsondanger
> On Feb 14, 2016, at 7:17 PM, Marcel Weiher wrote: > > >> On 11 Feb 2016, at 20:44, Dan Lau wrote: >> >> If a file has its contents mapped using NSData's >> initWithContentsOfFile + NSDataReadingMappedIfSafe, >> deleting it doesn't appear to affect reading it's mapped contents. Does >> any

Re: Deleting an file that's been NSData memory mapped - safe?

2016-02-14 Thread Chris Ridd
> On 14 Feb 2016, at 11:45, dangerwillrobinsondan...@gmail.com wrote: > > Would the file itself be accessible by another process before your process > exits? Only if it manages to open it before it gets unlinked. After it gets unlinked, there’s no way to open it because there’s no longer any a

Re: Swift bindings issue, Swift.Dictionary, NSMutableDictionary and NSObjectController

2016-02-14 Thread Jens Alfke
> On Feb 14, 2016, at 2:06 AM, Samuel Williams > wrote: > > 2/ Should I prefer NSMutableDictionary in the Swift code? It looks like you’ll need to use Foundation collection classes, for properties that you want to bind in this way. Remember, Swift’s native arrays and dictionaries aren’t toll

Re: Swift bindings issue, Swift.Dictionary, NSMutableDictionary and NSObjectController

2016-02-14 Thread Quincey Morris
On Feb 14, 2016, at 02:06 , Samuel Williams wrote: > > 2/ Should I prefer NSMutableDictionary in the Swift code? Is your Swift property declared ‘dynamic’. Also, keep in mind that the Swift type that’s bridgeable to NSDictionary is [NSObject, AnyObject]. Your type [String, __

Re: Swift bindings issue, Swift.Dictionary, NSMutableDictionary and NSObjectController

2016-02-14 Thread Quincey Morris
(sorry about the previous post, hit Send early by accident) On Feb 14, 2016, at 02:06 , Samuel Williams mailto:space.ship.travel...@gmail.com>> wrote: > > 2/ Should I prefer NSMutableDictionary in the Swift code? Is your Swift property declared ‘dynamic’? Also, keep in mind that the Swift type

Re: Swift bindings issue, Swift.Dictionary, NSMutableDictionary and NSObjectController

2016-02-14 Thread Samuel Williams
Yeah, the easiest solution was to not use a dictionary but use a class, which copied the data into the dictionary. Here is the top level sheet: class PMSRConfigurationSheet: NSWindowController { dynamic var metadata: [String : AnyObject] = [String : AnyObject]() override class func keyPathsFor