<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Sorry yeah you’re right, the example also requires conditional conformances. If you do not need dynamic dispatch in your use case then you can workaround the issue for now by hiding the protocol requirements and abusing the protocol extension:</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(248, 39, 80); background-color: rgb(31, 32, 41);">import<span style="color: #ffffff"> UIKit</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; background-color: rgb(31, 32, 41); min-height: 14px;"><br></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span style="color: #f82750">protocol</span> AreaProtocol { /* keep it empty */ }</p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; background-color: rgb(31, 32, 41); min-height: 14px;"><br></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span style="color: #f82750">extension</span> <span style="color: #fd9304">AreaProtocol</span> <span style="color: #f82750">where</span> <span style="color: #f82750">Self</span> : Sequence, <span style="color: #f82750">Self</span>.Element == CGPoint {</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #f82750">func</span> area() -&gt; <span style="color: #e9297e">CGFloat</span> {</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(248, 39, 80); background-color: rgb(31, 32, 41);"><span style="color: #ffffff"><span class="Apple-tab-span" style="white-space:pre">                </span></span>return<span style="color: #ffffff"> </span><span style="color: #fc65ff">0.0</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span class="Apple-tab-span" style="white-space:pre">        </span>}</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41); min-height: 13px;"><span class="Apple-tab-span" style="white-space:pre">        </span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #f82750">func</span> volume(height: <span style="color: #e9297e">CGFloat</span>) -&gt; <span style="color: #e9297e">CGFloat</span> {</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #f82750">return</span> height * <span style="color: #66f8f6">area</span>()</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span class="Apple-tab-span" style="white-space:pre">        </span>}</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);">}</p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; background-color: rgb(31, 32, 41); min-height: 14px;"><br></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(78, 79, 90); background-color: rgb(31, 32, 41);">// or directly</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span style="color: #f82750">extension</span> <span style="color: #e9297e">Sequence</span> <span style="color: #f82750">where</span> Element == CGPoint {</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(78, 79, 90); background-color: rgb(31, 32, 41);"><span style="color: #ffffff"><span class="Apple-tab-span" style="white-space:pre">        </span></span>// stuff from above</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);">}</p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; background-color: rgb(31, 32, 41); min-height: 14px;"><br></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(253, 147, 4); background-color: rgb(31, 32, 41);"><span style="color: #f82750">extension</span><span style="color: #ffffff"> </span><span style="color: #e9297e">Array</span><span style="color: #ffffff"> : </span>AreaProtocol<span style="color: #ffffff"> {}</span></p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; background-color: rgb(31, 32, 41); min-height: 14px;"><br></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span style="color: #f82750">let</span> p0 = <span style="color: #e9297e">CGPoint</span>(x: <span style="color: #fc65ff">0.0</span>, y: <span style="color: #fc65ff">0.0</span>)</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span style="color: #f82750">let</span> p1 = <span style="color: #e9297e">CGPoint</span>(x: <span style="color: #fc65ff">2.0</span>, y: <span style="color: #fc65ff">0.0</span>)</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span style="color: #f82750">let</span> p2 = <span style="color: #e9297e">CGPoint</span>(x: <span style="color: #fc65ff">2.0</span>, y: <span style="color: #fc65ff">2.0</span>)</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span style="color: #f82750">let</span> p3 = <span style="color: #e9297e">CGPoint</span>(x: <span style="color: #fc65ff">0.0</span>, y: <span style="color: #fc65ff">2.0</span>)</p>
<p style="margin: 0px; font-size: 12px; line-height: normal; font-family: Helvetica; background-color: rgb(31, 32, 41); min-height: 14px;"><br></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span style="color: #f82750">let</span> poligon = [<span style="color: #44c1fd">p0</span>,&nbsp;<span style="color: #44c1fd">p1</span>,&nbsp;<span style="color: #44c1fd">p2</span>,&nbsp;<span style="color: #44c1fd">p3</span>]</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span style="color: #f82750">let</span> a = <span style="color: #44c1fd">poligon</span>.<span style="color: #66f8f6">area</span>()</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: 'Fira Code'; color: rgb(255, 255, 255); background-color: rgb(31, 32, 41);"><span style="color: #f82750">let</span> v = <span style="color: #44c1fd">poligon</span>.<span style="color: #66f8f6">volume</span>(height: <span style="color: #fc65ff">10.0</span>)</p></div> <br> <div id="bloop_sign_1511615192423719936" class="bloop_sign"></div> <br><p class="airmail_on">Am 25. November 2017 um 13:58:44, Antonino Ficarra (<a href="mailto:antonino.ficarra@gmail.com">antonino.ficarra@gmail.com</a>) schrieb:</p> <blockquote type="cite" class="clean_bq"><span><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div></div><div>



<title class=""></title>


<div class="">Adrian,</div>
<div class="">thanks, but don’t work :-(</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">import</span>
Foundation</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">protocol</span>
AreaProtocol {</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// required</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">func</span> area()
-&gt; <span style="color: #703daa" class="">CGFloat</span></div>
<p style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 16px;" class=""><br class="webkit-block-placeholder"></p>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// implemented in protocol extension</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">func</span> volume(
height:<span style="color: #703daa" class="">CGFloat</span> ) -&gt;
<span style="color: #703daa" class="">CGFloat</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// ....</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">extension</span>
AreaProtocol <span style="color: #000000" class="">{</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">func</span> volume(
height:<span style="color: #703daa" class="">CGFloat</span> ) -&gt;
<span style="color: #703daa" class="">CGFloat</span> {</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">return</span> height
* <span style="color: #31595d" class="">area</span>()</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// ....</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// ....</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">protocol</span>
CGPointSequence: <span style="color: #703daa" class="">Sequence</span>, <span style="color: #4f8187" class="">AreaProtocol</span> <span style="color: #ba2da2" class="">where</span> <span style="color: #703daa" class="">Element</span> == <span style="color: #703daa" class="">CGPoint</span> {}</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">extension</span>
CGPointSequence <span style="color: #000000" class="">{</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">func</span> area()
-&gt; <span style="color: #703daa" class="">CGFloat</span> {</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">return</span>
<span style="color: #272ad8" class="">0.0</span> // ... poligon
area</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="text-decoration: underline ; color: #ba2da2" class="">e</span><span style="color: #ba2da2" class="">xtension</span> <span style="color: #703daa" class="">Array</span><span style="color: #000000" class="">:</span><span style="text-decoration: underline ; color: #4f8187" class="">CGPointSequence</span> <span style="color: #000000" class="">{}</span> // !'CGPointSequence' requires the types 'Element' and
'CGPoint' be equivalent</div>
</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">Il giorno 25 nov 2017, alle ore 09:11, Adrian Zubarev
&lt;<a href="mailto:adrian.zubarev@devandartist.com" class="">adrian.zubarev@devandartist.com</a>&gt; ha scritto:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">This is correct. None of your types does conform to
your protocol because you never conformance explicitly.&nbsp;
<div class=""><br class=""></div>
<div class="">The extenstion you wrote is just a conditional
extension which says if the Self type conforms to AreaProtocol and
the associated typed Element is a CGPoint then add the area method
to it. Nothing more, nothing less.</div>
<div class=""><br class=""></div>
<div class="">Now you may think that you have to rewrite that
extension to `extension Sequence : AreaProtocol where Element ==
CGPoint`, but that won't work because retroactively conforming
protocols to other protocols is not supported yet. Nor are
conditional conformances included yet, but they will in Swift 4.1
or 5.</div>
<div class=""><br class=""></div>
<div class="">You have one option left.</div>
<div class="">protocol MySequence : Sequence, AreaProtocol where
Element == CGPoint {}</div>
<div class=""><br class=""></div>
<div class="">extension Array : MySequence {}</div>
<div class=""><br class=""></div>
<div class="">Then also conform other sequences you need to support
that functionality.</div>
<div class=""><br class=""></div>
<div class="">Double check if the code compiles, I wrote it on my
iPhone, but you get the idea now.</div>
<div class=""><br class="">
<div class="bloop_sign">
<div style="font-family:helvetica,arial;font-size:13px" class="">
--&nbsp;<br class="">
Adrian Zubarev<br class="">
Sent with Airmail</div>
</div>
<p class="gmail_quote" style="">Am 25. November 2017 um 07:40:25,
Antonino Ficarra via swift-users (<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>)
schrieb:</p>
<blockquote type="cite" class="gmail_quote">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div class=""></div>
<div class="">
<div style="font-size: 14px;" class=""><span class="">In this code
example:</span></div>
<div style="font-size: 14px;" class=""><span class=""><br class=""></span></div>
<div class="">
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span class=""><span style="color: #ba2da2" class="">import</span> Foundation</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">protocol</span>
AreaProtocol {</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: rgb(186, 45, 162);" class="">func</span> area() -&gt; <span style="color: rgb(112, 61, 170);" class="">CGFloat</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 16px;" class=""><br class="webkit-block-placeholder"></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// implemented in protocol extension</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">func</span> volume(
height:<span style="color: #703daa" class="">CGFloat</span> ) -&gt;
<span style="color: #703daa" class="">CGFloat</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// ....</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">extension</span>
AreaProtocol <span style="" class="">{</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">func</span> volume(
height:<span style="color: #703daa" class="">CGFloat</span> ) -&gt;
<span style="color: #703daa" class="">CGFloat</span> {</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">return</span> height
* <span style="color: #31595d" class="">area</span>()</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// ....</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// ....</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">// conform CGPoint sequences to AreaProtocol</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(186, 45, 162); background-color: rgb(255, 255, 255);" class="">extension <span style="color: #703daa" class="">Sequence</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">where</span> Self
<span style="" class="">:</span> AreaProtocol<span style="" class="">,</span> <span style="color: #703daa" class="">Element</span>
<span style="" class="">==</span> <span style="color: #703daa" class="">CGPoint</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">{</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">func</span>
area()&nbsp;-&gt; <span style="color: #703daa" class="">CGFloat&nbsp;</span>{</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">return</span>
<span style="color: #272ad8" class="">0.0</span> // ... poligon
area</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">let</span> p0 =
<span style="color: #703daa" class="">CGPoint</span>(x:
<span style="color: #272ad8" class="">0.0</span>, y: <span style="color: #272ad8" class="">0.0</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">let</span> p1 =
<span style="color: #703daa" class="">CGPoint</span>(x:
<span style="color: #272ad8" class="">2.0</span>, y: <span style="color: #272ad8" class="">0.0</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">let</span> p2 =
<span style="color: #703daa" class="">CGPoint</span>(x:
<span style="color: #272ad8" class="">2.0</span>, y: <span style="color: #272ad8" class="">2.0</span>)</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">let</span> p3 =
<span style="color: #703daa" class="">CGPoint</span>(x:
<span style="color: #272ad8" class="">0.0</span>, y: <span style="color: #272ad8" class="">2.0</span>)</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">let</span> poligon =
[<span style="color: #4f8187" class="">p0</span>,<span style="color: #4f8187" class="">p1</span>,<span style="color: #4f8187" class="">p2</span>,<span style="color: #4f8187" class="">p3</span>]</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">let</span>
<span style="" class="">a&nbsp; =</span> <span style="color: #4f8187" class="">poligon</span><span style="" class="">.</span><span style="text-decoration: underline;" class="">a</span><span style="" class="">rea()</span>// ! Type
'[CGPoint]' does not conform to protocol 'AreaProtocol'</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">let</span>
<span style="" class="">v&nbsp; =</span> <span style="text-decoration: underline ; color: #4f8187" class="">p</span><span style="color: #4f8187" class="">oligon</span><span style="" class="">.volume(
height:</span><span style="color: #272ad8" class="">10.0</span>
<span style="" class="">)</span>// ! Value of type '[CGPoint]' has
no member 'volume'</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class=""><br class=""></div>
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);" class="">
<div style="font-family: Helvetica;" class="">An array of CGPoint
is a CGPoint sequence? Why the array don't gets automatic
conformance to AreaProtocol?</div>
<div style="font-family: Helvetica;" class="">How can conform an
array of CGPoint to AreaProtocol?</div>
<div style="font-family: Helvetica;" class=""><br class=""></div>
<div style="font-family: Helvetica;" class="">Sorry for my bad
english,</div>
<div style="font-family: Helvetica;" class="">Antonino</div>
<div style="font-family: Helvetica; font-size: 12px;" class="">
<br class=""></div>
</div>
_______________________________________________<br class="">
swift-users mailing list<br class="">
<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">
https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">


</div></div></span></blockquote></body></html>