<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">I propose to allow static protocol extension methods to be used directly on the protocol.</div><div class="">This would enable the Factory-pattern to be elegantly implemented as in the example below:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><div style="margin: 0px; line-height: normal;" class="">protocol<span style="font-size: 13px; line-height: normal; color: rgb(0, 0, 0);" class=""> P {}</span></div><div style="margin: 0px; font-size: 13px; line-height: normal; min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><span style="font-size: 12px; line-height: normal;" class="">class</span> A : <span style="font-size: 12px; line-height: normal; color: rgb(79, 129, 135);" class="">P</span> {}</div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><span style="font-size: 12px; line-height: normal;" class="">class</span> B : <span style="font-size: 12px; line-height: normal; color: rgb(79, 129, 135);" class="">P</span> {}</div><div style="margin: 0px; font-size: 13px; line-height: normal; min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">extension<span style="font-size: 13px; line-height: normal; color: rgb(0, 0, 0);" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">P</span><span style="font-size: 13px; line-height: normal; color: rgb(0, 0, 0);" class=""> {</span></div><div style="margin: 0px; font-size: 13px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="font-size: 12px; line-height: normal;" class="">static</span> <span style="font-size: 12px; line-height: normal;" class="">func</span> factory(type: <span style="font-size: 12px; line-height: normal; color: rgb(112, 61, 170);" class="">Bool</span>) -> <span style="font-size: 12px; line-height: normal; color: rgb(79, 129, 135);" class="">P</span> { <span style="font-size: 12px; line-height: normal;" class="">return</span> type ? <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">A</span>() : <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">B</span>()}</div><div style="margin: 0px; font-size: 13px; line-height: normal;" class="">}</div><div style="margin: 0px; font-size: 13px; line-height: normal; min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span><span style="font-size: 13px; line-height: normal; color: rgb(0, 0, 0);" class=""> a = </span><span style="font-size: 13px; line-height: normal; color: rgb(79, 129, 135);" class="">P</span><span style="font-size: 13px; line-height: normal; color: rgb(0, 0, 0);" class="">.factory(</span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">false</span><span style="font-size: 13px; line-height: normal; color: rgb(0, 0, 0);" class="">) </span>// <- Not possible in Swift 2, factory() can only be used on either A or B</div><div class=""><br class=""></div></div></div><div class="">Regards</div><div class=""><br class=""></div>Rasmus Friis Kjeldsen<div class=""><br class=""></div><div class=""><br class=""></div></body></html>