Re: [swift-users] @NSCopying semantic does not appear to copy in Swift initializer

2017-01-30 Thread Torin Kwok via swift-users
Haha yes, you're right. I misunderstanded your idea, sorry. Indeed, in Obj-C, we have the freedom to decide on whether or not assign a value to a property by invoking setter or by accessing ivar directly and Apple's official documentation apparently suggested that we should always access the

Re: [swift-users] @NSCopying semantic does not appear to copy in Swift initializer

2017-01-30 Thread Quinn "The Eskimo!" via swift-users
On 30 Jan 2017, at 10:12, Torin Kwok wrote: > In Obj-C, if a property has promised that it conforms to > porotocl and that it would respect copying semantic by being qualified > with `@property (copy)`, then we assign a value to `ivar` through the > setter by writting down

Re: [swift-users] @NSCopying semantic does not appear to copy in Swift initializer

2017-01-30 Thread Quinn "The Eskimo!" via swift-users
On 27 Jan 2017, at 18:56, Jordan Rose via swift-users wrote: > @NSCopying currently does not affect initializers. … it's not 100%, for-sure > a bug. Just by way of context, this current behaviour closely matches Objective-C conventions, where `-init` methods directly

Re: [swift-users] @NSCopying semantic does not appear to copy in Swift initializer

2017-01-27 Thread Rod Brown via swift-users
Hi Torin, Just a few notes: I believe the @NSCopying behaviour actually uses the copy(with zone: NSZone?) method rather than the indirect copy() method. I would check that you’ve implemented that correctly. If you have, then it appears to be a bug. I would breakpoint on this method (not

[swift-users] @NSCopying semantic does not appear to copy in Swift initializer

2017-01-26 Thread Torin Kwok via swift-users
Hello guys, I wanna ask a question about the behavior of `@NSCopying` semantic in Swift 3. Well, according to Apple's official documentation: > In Swift, the Objective-C copy property attribute translates to > @NSCopying. The type of the property must conform to the NSCopying > protocol.