Actually partially related. The /*@NSCopying*/ comments are hints that we left when initially importing that the return value should be copied. It is again a export from it’s objc nature. In this case having a property with copy.
e.g. @property (copy) NSData *data; exports as @NSCopying public var data: NSData! This is mainly there to preserve the copy nature when subclasses are implemented. > On Mar 17, 2016, at 7:48 AM, Pushkar N Kulkarni <[email protected]> wrote: > > Sorry for intruding! > > I have the same question about /*@NSCopying*/ > > Pushkar N Kulkarni, > IBM Runtimes > > Simplicity is prerequisite for reliability - Edsger W. Dijkstra > > > > [email protected] > <mailto:[email protected]> wrote: ----- > To: Daniel Eggert <[email protected] <mailto:[email protected]>> > From: Philippe Hausler via swift-corelibs-dev > Sent by: [email protected] > <mailto:[email protected]> > Date: 03/17/2016 08:12PM > Cc: Swift corelibs dev <[email protected] > <mailto:[email protected]>> > Subject: Re: [swift-corelibs-dev] non-inherited init > > That is a comment emitted by the importer, unfortunately it is impossible for > non objc to mimic that behavior 100% because it is an init method that is > constructed from a class method. > > @interface Foo : NSObject > + (Foo *)fooNamed:(NSString *)name; // this is not an inherited init method > in that it will always return an instance of a Foo no matter the subclass it > is called from > @end > > @interface Bar : Foo > @end > > // in objc it is like this: > Foo *f = [Bar fooNamed:@“test”]; > > // in swift it is like this: > let f = Bar(named:”test”) > > but obviously by the method fooNamed always returns a Foo instead of an > instancetype because it actually looks up Foo objects from a table. > > > On Mar 17, 2016, at 7:35 AM, Daniel Eggert via swift-corelibs-dev > > <[email protected] <mailto:[email protected]>> wrote: > > > > There're some initializers (namely in NSURLSession) that have a comment: > > > > public /*not inherited*/ init(... > > > > What is this “not inherited” comment trying to convey, and how would one go > > about implementing this in Swift? > > > > /Daniel > > > > _______________________________________________ > > swift-corelibs-dev mailing list > > [email protected] <mailto:[email protected]> > > https://lists.swift.org/mailman/listinfo/swift-corelibs-dev > > <https://lists.swift.org/mailman/listinfo/swift-corelibs-dev> > > _______________________________________________ > swift-corelibs-dev mailing list > [email protected] <mailto:[email protected]> > https://lists.swift.org/mailman/listinfo/swift-corelibs-dev > <https://lists.swift.org/mailman/listinfo/swift-corelibs-dev> >
_______________________________________________ swift-corelibs-dev mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
