Re: Swift -> Obj-C: return __kindof Something
Re: Swift -> Obj-C: return __kindof Something
- Subject: Re: Swift -> Obj-C: return __kindof Something
- From: Quincey Morris via Cocoa-dev <email@hidden>
- Date: Mon, 11 Nov 2019 18:48:14 -0800
There’s now a Swift equivalent (loosely): “some NSManagedObject”. It’s
sometimes referred to as a “reverse generic”, or “opaque type” because it hides
the actual type behind a larger class type or protocol. The evolution proposal
is here, if you want all the gory details:
https://github.com/apple/swift-evolution/blob/master/proposals/0244-opaque-result-types.md
<https://github.com/apple/swift-evolution/blob/master/proposals/0244-opaque-result-types.md>
The problem is, it was designed mainly for return types, and I’m not sure it’s
entirely easy to use for a stored property. On top of that, it may not work
with an optional base type.
Still, it might be worth looking into. Again, ask on the Swift forum for
guidance. You’ll get good answers.
> On Nov 11, 2019, at 18:06 , Steve Christensen <email@hidden> wrote:
>
> I’m trying to get the same class-or-subclass behavior during compilation.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden