So Mixins are a way of opting in to shared behaviour. 

Think of it as having default implementations for protocols 

So you could have code that handles pagination rather than implement it 
multiple times you mix it into multiple classes. Ruby and JavaScript support 
these

But in swift to do this you  have to define a protocol, make your class extend 
from it and then extend the protocol with some methods 

The downside is this isn't a true mixin implementation as typically Mixins 
allow you to specific properties. 

So Mixins are closer to extensions with support for properties which you can 
include to multiple classes 

Sent from my iPhone

> On 23 Dec 2015, at 19:57, Joe Groff <[email protected]> wrote:
> 
> 
>> On Dec 23, 2015, at 11:54 AM, James Campbell via swift-evolution 
>> <[email protected]> wrote:
>> 
>> Mixins would be a great addition instead of having to define a protocol and 
>> then extending it 
>> 
> 
> Mixins are a vague term. What exactly do you propose?
> 
> -Joe
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to