This seems to work in a playground:
import CoreData
protocol SomeProtocol {}
class Foo<T: NSManagedObject> where T: SomeProtocol {}
> On Feb 22, 2017, at 4:08 PM, Dave Reed via swift-users
> <[email protected]> wrote:
>
> I suspect this can't be done (at least not right now), but wanted to check.
>
> I'd like to declare a class as a generic that meets a protocol and is also a
> subclass of some specific type.
>
> Something like class Foo<T:NSManangedObject,SomeProtocol> (i.e., the T must
> be both a NSManagedObject or subclass of it and conform to SomeProtocol).
>
> Is this possible?
>
> Thanks,
> Dave Reed
>
> _______________________________________________
> swift-users mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-users
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users