[swift-users] Unexpected Optional unwrapping in generic fn

2016-05-15 Thread Michael Gardner via swift-users
I'm having trouble understanding why the following code is trying to unwrap an Optional. class Proxy { var value:T init(_ value:T) { self.value = value } } func setter(p:Proxy) -> Any? -> () { return {p.value = $0 as! T} } var i = Proxy(

[swift-users] Double pointer in ObjC function signature importing incorrectly in Swift 3?

2016-09-20 Thread Michael Gardner via swift-users
I'm using an Objective-C library that has me provide a callback that takes a double-pointer parameter like this, where only the inner pointer is nullable: CKRecord *_Nonnull *_Nullable inOutRecordPtr Swift 2 imported this as an AutoreleasingUnsafeMutablePointer, as expected. However, Swift 3 is

Re: [swift-users] What is the intended response to Array change notification for dependents?

2017-03-07 Thread Michael Gardner via swift-users
The general approach would be to run a diff between your old and new arrays. Something like https://github.com/jflinter/Dwifft could help, though I haven't used it personally. Another approach is to build a wrapper around your source array with limited modification methods and a KVO-like notifi

Re: [swift-users] What is the intended response to Array change notification for dependents?

2017-03-07 Thread Michael Gardner via swift-users
> On Mar 7, 2017, at 10:14, Jens Alfke wrote: > > >> On Mar 7, 2017, at 9:28 AM, Michael Gardner via swift-users >> wrote: >> >> The general approach would be to run a diff between your old and new arrays. >> Something like https://github.c