Sorry for intruding!
I have the same question about /*@NSCopying*/
Pushkar N Kulkarni,
Pushkar N Kulkarni,
IBM Runtimes
Simplicity is prerequisite for reliability - Edsger W. Dijkstra
-----swift-corelibs-dev-boun...@swift.org wrote: -----
To: Daniel Eggert <danielegg...@me.com>
From: Philippe Hausler via swift-corelibs-dev
Sent by: swift-corelibs-dev-boun...@swift.org
Date: 03/17/2016 08:12PM
Cc: Swift corelibs dev <swift-corelibs-dev@swift.org>
Subject: Re: [swift-corelibs-dev] non-inherited init
From: Philippe Hausler via swift-corelibs-dev
Sent by: swift-corelibs-dev-boun...@swift.org
Date: 03/17/2016 08:12PM
Cc: Swift corelibs dev <swift-corelibs-dev@swift.org>
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 <swift-corelibs-dev@swift.org> 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
> swift-corelibs-dev@swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
@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 <swift-corelibs-dev@swift.org> 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
> swift-corelibs-dev@swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
_______________________________________________ swift-corelibs-dev mailing list swift-corelibs-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-corelibs-dev