<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Any suggestions on how to work around it or to fix it?<div class=""><br class=""></div><div class=""><img apple-inline="yes" id="AF8D46B8-458A-4657-AB20-D2617B626340" height="95" width="822" apple-width="yes" apple-height="yes" src="cid:919771B3-8556-4299-BA14-BF285E8AE163@home" class=""></div><div class=""><br class=""></div><div class="">Thanks in advance!</div><div class=""><br class=""></div><div class="">— A</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 5, 2016, at 12:00 PM, Zhao Xin <<a href="mailto:owenzx@gmail.com" class="">owenzx@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:georgia,serif">You are right. Int conforms to Strideable.</div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default" style="font-family:georgia,serif">Now it seams like a bug. As in a playground. below are code works and doesn't work</div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px" class=""><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="" class="">extension</span><span style="" class=""> </span><span style="color:rgb(112,61,170)" class="">Int</span><span style="" class=""> {</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">func</span><span style="" class=""> test() {</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">let</span><span style="" class=""> temp = stride(from:</span><span style="color:rgb(39,42,216)" class="">1</span><span style="" class="">, to:</span><span style="color:rgb(39,42,216)" class="">10</span><span style="" class="">, by:</span><span style="color:rgb(39,42,216)" class="">2</span><span style="" class="">) </span><span style="color:rgb(0,132,0)" class="">// error</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> }</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">}</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="" class="">extension</span><span style="" class=""> </span><span style="color:rgb(112,61,170)" class="">Float</span><span style="" class=""> {</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">func</span><span style="" class=""> test() {</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">let</span><span style="" class=""> temp = stride(from:</span><span style="color:rgb(39,42,216)" class="">1</span><span style="" class="">, to:</span><span style="color:rgb(39,42,216)" class="">10</span><span style="" class="">, by:</span><span style="color:rgb(39,42,216)" class="">2</span><span style="" class="">) </span><span style="color:rgb(0,132,0)" class="">// error</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> }</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">}</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="" class="">extension</span><span style="" class=""> </span><span style="color:rgb(112,61,170)" class="">String</span><span style="" class=""> {</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">func</span><span style="" class=""> test() {</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">let</span><span style="" class=""> temp = </span><span style="color:rgb(61,29,129)" class="">stride</span><span style="" class="">(from:</span><span style="color:rgb(39,42,216)" class="">1</span><span style="" class="">, to:</span><span style="color:rgb(39,42,216)" class="">10</span><span style="" class="">, by:</span><span style="color:rgb(39,42,216)" class="">2</span><span style="" class="">) </span><span style="color:rgb(0,132,0)" class="">// works</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> }</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">}</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="" class="">class</span><span style="" class=""> A {</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span style="" class=""> </span><br class="webkit-block-placeholder"></p></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">}</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="" class="">extension</span><span style="" class=""> </span><span style="color:rgb(79,129,135)" class="">A</span><span style="" class=""> {</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">func</span><span style="" class=""> test() {</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">let</span><span style="" class=""> temp = </span><span style="color:rgb(61,29,129)" class="">stride</span><span style="" class="">(from:</span><span style="color:rgb(39,42,216)" class="">1</span><span style="" class="">, to:</span><span style="color:rgb(39,42,216)" class="">10</span><span style="" class="">, by:</span><span style="color:rgb(39,42,216)" class="">2</span><span style="" class="">) </span><span style="color:rgb(0,132,0)" class="">// works</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> }</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">}</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="" class="">struct</span><span style="" class=""> B {</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span style="" class=""> </span><br class="webkit-block-placeholder"></p></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">}</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="" class="">extension</span><span style="" class=""> </span><span style="color:rgb(79,129,135)" class="">B</span><span style="" class=""> {</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">func</span><span style="" class=""> test() {</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">let</span><span style="" class=""> temp = </span><span style="color:rgb(61,29,129)" class="">stride</span><span style="" class="">(from:</span><span style="color:rgb(39,42,216)" class="">1</span><span style="" class="">, to:</span><span style="color:rgb(39,42,216)" class="">10</span><span style="" class="">, by:</span><span style="color:rgb(39,42,216)" class="">2</span><span style="" class="">) </span><span style="color:rgb(0,132,0)" class="">// works</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> }</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">}</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class="">func</span><span style="" class=""> test() {</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class=""> </span><span style="color:rgb(187,44,162)" class="">let</span><span style="" class=""> temp = </span><span style="color:rgb(61,29,129)" class="">stride</span><span style="" class="">(from:</span><span style="color:rgb(39,42,216)" class="">1</span><span style="" class="">, to:</span><span style="color:rgb(39,42,216)" class="">10</span><span style="" class="">, by:</span><span style="color:rgb(39,42,216)" class="">2</span><span style="" class="">) </span><span style="color:rgb(0,132,0)" class="">//works</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="" class="">}</span></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div></div><div class="gmail_default" style="font-family:georgia,serif"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class="">let</span><span style="" class=""> temp = </span><span style="color:rgb(61,29,129)" class="">stride</span><span style="" class="">(from:</span><span style="color:rgb(39,42,216)" class="">1</span><span style="" class="">, to:</span><span style="color:rgb(39,42,216)" class="">10</span><span style="" class="">, by:</span><span style="color:rgb(39,42,216)" class="">2</span><span style="" class="">) </span><span style="color:rgb(0,132,0)" class="">// works</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(0,132,0)" class=""><br class=""></span></div></div></blockquote><font face="georgia, serif" class=""><div class="gmail_default" style="display:inline">It is nothing bug a bug?</div><br class=""></font><blockquote style="margin:0 0 0 40px;border:none;padding:0px" class=""><div class="gmail_default"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(0,132,0)" class=""><br class=""></span></div></div></blockquote><div class="gmail_default" style="display:inline"><font face="georgia, serif" class="">Zhaoxin</font></div><br class=""><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span style="" class=""></span><br class="webkit-block-placeholder"></p>
</div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span style="" class=""></span><br class="webkit-block-placeholder"></p>
</div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span style="" class=""></span><br class="webkit-block-placeholder"></p>
</div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span style="" class=""></span><br class="webkit-block-placeholder"></p>
</div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span style="" class=""></span><br class="webkit-block-placeholder"></p>
</div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span style="" class=""></span><br class="webkit-block-placeholder"></p>
</div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span style="" class=""></span><br class="webkit-block-placeholder"></p>
</div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span style="" class=""></span><br class="webkit-block-placeholder"></p>
</div><div class="gmail_default" style="font-family:georgia,serif"><div class=""><span style="color:rgb(0,132,0)" class=""><br class=""></span></div></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jul 5, 2016 at 10:16 PM, Shawn Erickson <span dir="ltr" class=""><<a href="mailto:shawnce@gmail.com" target="_blank" class="">shawnce@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Int conforms to Strideable byway of Integer <- SignedInteger <- Int (not exactly sure how it will be once the integer proposal is implemented but it will still be strideable).<span class="HOEnZb"><font color="#888888" class=""><br class=""><br class="">-Shawn</font></span><div class="HOEnZb"><div class="h5"><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Mon, Jul 4, 2016 at 10:38 PM Zhao Xin via swift-users <<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class="gmail_default" style="font-family:georgia,serif">In Swift 3, </div><div class="gmail_default" style="font-family:georgia,serif"><span style="font-family:'SF Mono',Menlo,monospace;font-size:14px;color:rgb(170,13,145)" class=""><br class=""></span></div><div class="gmail_default" style="font-family:georgia,serif"><span style="font-family:'SF Mono',Menlo,monospace;font-size:14px;color:rgb(170,13,145)" class="">func</span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px;background-color:rgb(250,250,250)" class=""> </span><span style="font-family: 'SF Mono', Menlo, monospace; font-size: 14px;" class="">stride</span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px;background-color:rgb(250,250,250)" class=""><</span><span style="font-family: 'SF Mono', Menlo, monospace; font-size: 14px;" class="">T</span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px;background-color:rgb(250,250,250)" class=""> : </span><span style="font-family:'SF Mono',Menlo,monospace;font-size:14px;color:rgb(92,38,153)" class=""><a style="color:rgb(92,38,153);text-decoration:none" class="">Strideable</a></span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px;background-color:rgb(250,250,250)" class="">>(</span><span style="font-family: 'SF Mono', Menlo, monospace; font-size: 14px;" class="">from</span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px;background-color:rgb(250,250,250)" class=""> </span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px" class="">start</span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px;background-color:rgb(250,250,250)" class="">: T, </span><span style="font-family: 'SF Mono', Menlo, monospace; font-size: 14px;" class="">to</span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px;background-color:rgb(250,250,250)" class=""> </span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px" class="">end</span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px;background-color:rgb(250,250,250)" class="">: T, </span><span style="font-family: 'SF Mono', Menlo, monospace; font-size: 14px;" class="">by</span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px;background-color:rgb(250,250,250)" class=""> </span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px" class="">stride</span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px;background-color:rgb(250,250,250)" class="">: T.Stride) -> </span><span style="font-family:'SF Mono',Menlo,monospace;font-size:14px;color:rgb(92,38,153)" class=""><a style="color:rgb(92,38,153);text-decoration:none" class="">StrideTo</a></span><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px;background-color:rgb(250,250,250)" class=""><T></span></div><div class="gmail_default" style="font-family:georgia,serif"><span style="font-family:'SF Mono',Menlo,monospace;color:rgb(51,51,51);font-size:14px;background-color:rgb(250,250,250)" class=""><br class=""></span></div><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="background-color:rgb(250,250,250)" class="">Int does not </span>conform to Strideable. </font></div><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><br class=""></span></font></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default">Adopted By</div></span></font></div><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default"><br class=""></div></span></font></div><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default">CGFloat</div></span></font></div><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default">Decimal</div></span></font></div><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default">Double</div></span></font></div><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default">Float</div></span></font></div><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default">Float80</div></span></font></div><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default">String.UTF16View.Index</div></span></font></div><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default">UnsafeMutablePointer</div></span></font></div><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default">UnsafePointer</div><div class="gmail_default"><br class=""></div></span></font></div></blockquote><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default" style="font-family:georgia,serif;display:inline">In Swift 2.2,</div></span></font><div class=""><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default" style="font-family:georgia,serif;display:inline"><br class=""></div></span></font></div><div class=""><span style="background-color:transparent;border:0px;font-size:12px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(170,51,145);font-family:Menlo,monospace" class="">@warn_unused_result</span><span style="font-family: Menlo, monospace; font-size: 12px;" class=""> </span><span style="background-color:transparent;border:0px;font-size:12px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(170,51,145);font-family:Menlo,monospace" class="">func</span><span style="font-family: Menlo, monospace; font-size: 12px;" class=""> </span><span style="background-color: transparent; border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace;" class="">stride</span><span style="font-family: Menlo, monospace; font-size: 12px;" class="">(</span><span style="background-color: transparent; border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace;" class="">to</span><span style="font-family: Menlo, monospace; font-size: 12px;" class=""> </span><code style="background-color: transparent; border: 0px; font-size: 12px; margin: 0px 0px 15px; outline: 0px; padding: 0px 0px 6px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;" class=""><em style="background-color:transparent;border:0px;font-size:0.92307em;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(65,65,65);line-height:1.5" class="">end</em></code><span style="font-family: Menlo, monospace; font-size: 12px;" class="">: </span><span style="background-color:rgb(255,255,255);border:0px;font-size:12px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(92,38,153);font-family:Menlo,monospace" class="">Self</span><span style="font-family: Menlo, monospace; font-size: 12px;" class="">, </span><span style="background-color: transparent; border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace;" class="">by</span><span style="font-family: Menlo, monospace; font-size: 12px;" class=""> </span><code style="background-color: transparent; border: 0px; font-size: 12px; margin: 0px 0px 15px; outline: 0px; padding: 0px 0px 6px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word;" class=""><em style="background-color:transparent;border:0px;font-size:0.92307em;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(65,65,65);line-height:1.5" class="">stride</em></code><span style="font-family: Menlo, monospace; font-size: 12px;" class="">: </span><span style="background-color:rgb(255,255,255);border:0px;font-size:12px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(92,38,153);font-family:Menlo,monospace" class="">Self</span><span style="font-family: Menlo, monospace; font-size: 12px;" class="">.</span><span style="background-color:rgb(255,255,255);border:0px;font-size:12px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(92,38,153);font-family:Menlo,monospace" class="">Stride</span><span style="font-family: Menlo, monospace; font-size: 12px;" class="">) -> </span><span style="background-color:rgb(255,255,255);border:0px;font-size:12px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(92,38,153);font-family:Menlo,monospace" class=""><a style="background-color:transparent;border:0px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:inherit;text-decoration:none" class="">StrideTo</a></span><span style="font-family: Menlo, monospace; font-size: 12px;" class=""><</span><span style="background-color:rgb(255,255,255);border:0px;font-size:12px;margin:0px;outline:0px;padding:0px;vertical-align:baseline;color:rgb(92,38,153);font-family:Menlo,monospace" class="">Self</span><span style="font-family: Menlo, monospace; font-size: 12px;" class="">></span></div><div class=""><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default" style="font-family:georgia,serif;display:inline"><br class=""></div></span></font></div><div class=""><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><div class="gmail_default" style="font-family:georgia,serif;display:inline">It uses Self, which means the type of the variable, instead of T.</div></span></font></div><div class=""><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class=""><br class=""></span></font></div><div class="gmail_default"><font color="#333333" face="SF Mono, Menlo, monospace" class=""><span style="font-size:14px" class="">Zhaoxin</span></font></div></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jul 5, 2016 at 11:41 AM, Adriano Ferreira via swift-users <span dir="ltr" class=""><<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">Hi everyone!</div><div class=""><br class=""></div><div class="">I’m converting some code to Swift 3 and got this issue?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><img height="95" width="822" class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Does anybody know what’s going on?</div><div class=""><br class=""></div><div class="">Here’s the code, before and after conversion:</div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><br class=""></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><br class=""></div></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><div style="font-family:Helvetica;font-size:12px" class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:rgb(0,132,0)" class="">// Swift 2.2</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(187,44,162)" class=""><span class="">extension</span><span style="" class=""> </span><span style="color:rgb(112,61,170)" class="">Int</span><span style="" class=""> {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><br class=""><span class=""></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span style="" class=""> </span><span class="">// Repeat a block of code from `self` up to a limit</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> </span><span style="color:rgb(187,44,162)" class="">func</span><span class=""> up(to upper: </span><span style="color:rgb(112,61,170)" class="">Int</span><span class="">, by step: </span><span style="color:rgb(112,61,170)" class="">Int</span><span class=""> = </span><span style="color:rgb(39,42,216)" class="">1</span><span class="">, </span><span style="color:rgb(187,44,162)" class="">@noescape</span><span class=""> closure:</span><span class=""> () -> </span><span style="color:rgb(112,61,170)" class="">Void</span><span class="">) {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span class=""></span><br class=""></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> </span><span style="color:rgb(187,44,162)" class="">for</span><span class=""> </span><span style="color:rgb(187,44,162)" class="">_</span><span class=""> </span><span style="color:rgb(187,44,162)" class="">in</span><span class=""> <span style="color:rgb(187,44,162)" class="">self</span><span class="">.</span>stride(</span><span class="">to: upper, by: step) {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> closure()</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="">}</span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class=""><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:rgb(0,132,0)" class="">// Swift 3</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(187,44,162)" class=""><span class="">extension</span><span style="" class=""> </span><span style="color:rgb(112,61,170)" class="">Int</span><span style="" class=""> {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><br class=""><span class=""></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)" class=""><span style="" class=""> </span><span class="">// Repeat a block of code from `self` up to a limit</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> </span><span style="color:rgb(187,44,162)" class="">func</span><span class=""> up(to upper: </span><span style="color:rgb(112,61,170)" class="">Int</span><span class="">, by step: </span><span style="color:rgb(112,61,170)" class="">Int</span><span class=""> = </span><span style="color:rgb(39,42,216)" class="">1</span><span class="">, </span><span style="color:rgb(187,44,162)" class="">_</span><span class=""> closure: </span><span style="color:rgb(187,44,162)" class="">@noescape</span><span class=""> () -> </span><span style="color:rgb(112,61,170)" class="">Void</span><span class="">) {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px" class=""><span class=""></span><br class=""></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> </span><span style="color:rgb(187,44,162)" class="">for</span><span class=""> </span><span style="color:rgb(187,44,162)" class="">_</span><span class=""> </span><span style="color:rgb(187,44,162)" class="">in</span><span class=""> stride(from: </span><span style="color:rgb(187,44,162)" class="">self</span><span class="">, to: upper, by: step) {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> closure()</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="">}</span></div></div><div class=""><span class=""><br class=""></span></div></span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class=""><span style="color:rgb(0,132,0);font-family:Menlo;font-size:11px" class="">// Usage</span></span></div><div class=""><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:#272ad8" class="">1</span><span class="">.</span><span style="color:#31595d" class="">up</span><span class="">(to: </span><span style="color:#272ad8" class="">10</span><span class="">, by: </span><span style="color:#272ad8" class="">2</span><span class="">) {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""> </span><span style="color:#3d1d81" class="">print</span><span class="">(</span><span style="color:#d12f1b" class="">"Hi!"</span><span class="">)</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="">}</span></div></div></div></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""><br class=""></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class=""><br class=""></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-family:Helvetica;font-size:12px" class="">Best,</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="font-family:Helvetica;font-size:12px" class=""><br class=""></span></div><div style="margin:0px;line-height:normal" class="">— A</div></div><br class="">_______________________________________________<br class="">
swift-users mailing list<br class="">
<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class="">
<br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">
swift-users mailing list<br class="">
<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class="">
</blockquote></div>
</div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></body></html>