<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=""><div><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><br class=""></div><div class="">I named the method(s) „toDict“ instead of „map“ because map normally returns a collection which is either the same as the receiver or a simple one.</div><div class="">The second version is more general and allows to do things like</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 13px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">let</span> dict = [<span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">"Tom"</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">"Dick"</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">"Harry"</span>].<span style="font-variant-ligatures: no-common-ligatures; color: #6c71c4" class="">enumerate</span>().<span style="font-variant-ligatures: no-common-ligatures; color: #6c71c4" class="">toDict</span> { (index, value) <span style="font-variant-ligatures: no-common-ligatures; color: #859901" class="">in</span> (index + <span style="font-variant-ligatures: no-common-ligatures; color: #29a198" class="">1</span>, value) }</div></div><div class=""><br class=""></div></div></blockquote><br class=""></div><div>Map would probably be a more correct mathematically speaking — but it would be inconsistent with the naming convention already chosen for Swift. So for Swift - toDict (or toDictionary) would be the best choice.</div><div><br class=""></div><div><br class=""></div><br class=""></body></html>