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 instan

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

2017-01-30 Thread Torin Kwok via swift-users
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 `self.ivar = whatever` in `-init`, accessing would not be direct but via the

[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. However