In Obj-C, if a property has promised that it conforms to <NSCopying>
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 setter. This behaviour, in fact, doesn't
match Obj-C conventions.

Quinn The Eskimo! via swift-users writes:

> On 27 Jan 2017, at 18:56, Jordan Rose via swift-users <swift-users@swift.org> 
> 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 access ivars and are expected to 
> do any necessary copies.
>
> Share and Enjoy


-- 
Torin Kwok (郭桐)
OpenPGP/GnuPG: https://keybase.io/kwok
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to