<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div style="font-size: 14px;" class="">In this code example:</div><div style="font-size: 14px;" 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=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span style="color: rgb(186, 45, 162);" class="">func</span><span class="Apple-tab-span" style="white-space: pre;">        </span>area() -> <span style="color: rgb(112, 61, 170);" 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=""><span class="Apple-tab-span" style="white-space:pre">        </span><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=""><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span>// 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 class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #ba2da2" class="">func</span><span class="Apple-tab-span" style="white-space:pre">        </span>volume( height:<span style="color: #703daa" class="">CGFloat</span> ) -> <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: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></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; 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><span style="color: #000000" class=""> </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 class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #ba2da2" class="">func</span><span class="Apple-tab-span" style="white-space:pre">        </span>volume( height:<span style="color: #703daa" class="">CGFloat</span> ) -> <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 class="Apple-tab-span" style="white-space:pre">                </span><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=""><span class="Apple-tab-span" style="white-space:pre">        </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: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></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: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></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; 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: #000000" class=""> </span><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: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #ba2da2" class="">where</span><span style="color: #000000" class=""> </span>Self<span style="color: #000000" class=""> : </span>AreaProtocol<span style="color: #000000" class="">, </span><span style="color: #703daa" class="">Element</span><span style="color: #000000" 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 class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #ba2da2" class="">func</span> area() -> <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: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">                </span></span><span style="color: #ba2da2" class="">return</span><span style="color: #000000" class=""> </span><span style="color: #272ad8" class="">0.0</span><span style="color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span></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=""><span class="Apple-tab-span" style="white-space:pre">        </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; 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="color: #000000" class=""> a = </span><span style="color: #4f8187" class="">poligon</span><span style="color: #000000" class="">.</span><span style="text-decoration: underline ; color: #000000" class="">a</span><span style="color: #000000" class="">rea()<span class="Apple-tab-span" style="white-space:pre">                        </span></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="color: #000000" class=""> v = </span><span style="text-decoration: underline ; color: #4f8187" class="">p</span><span style="color: #4f8187" class="">oligon</span><span style="color: #000000" class="">.volume( height:</span><span style="color: #272ad8" class="">10.0</span><span style="color: #000000" class=""> )<span class="Apple-tab-span" style="white-space:pre">        </span></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="color: rgb(0, 0, 0); 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="color: rgb(0, 0, 0); font-family: Helvetica;" class="">How can conform an array of CGPoint to AreaProtocol?</div><div style="color: rgb(0, 0, 0); font-family: Helvetica;" class=""><br class=""></div><div style="color: rgb(0, 0, 0); font-family: Helvetica;" class="">Sorry for my bad english,</div><div style="color: rgb(0, 0, 0); font-family: Helvetica;" class="">Antonino</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px;" class=""><br class=""></div></div></body></html>