On Jun 16, 2015, at 22:37 , Roland King <[email protected]> wrote:
>
> No - can’t have a stored property in an extension
(Someone just asked basically the same question in the dev forums, but with a
different example. Was that you?)
The following compiles for me without error:
> public protocol Foo {
> mutating func foo( Int )->Void
> }
>
> extension Foo {
> internal mutating func fooInternal( Int )->Void {}
> public mutating func foo( i: Int )->Void { fooInternal (i)}
> }
>
> internal protocol FooInternal: Foo {
> mutating func fooInternal( Int )->Void
> }
>
> internal protocol FooArray: FooInternal {
> var bar : Array<Int> { get set }
> }
>
> extension FooArray {
> mutating func fooInternal( i: Int )->Void { bar.append( i )}
> }
>
> public struct AFoo: Foo {
> public mutating func foo( Int )->Void { print ("cheers")}
> }
>
> public struct BFoo: Foo, FooArray {
> var bar : Array<Int> = []
> }
I’m not absolutely sure it does what you want, and if it does I’m not sure it’s
the shortest possible sequence. But it compiles without error.
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]