<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1478858311546_9057" dir="ltr"><span style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;" id="yui_3_16_0_ym19_1_1478858311546_9087">&gt; &nbsp;SE-0100 Add sequence-based initializers and merge methods to Dictionary</span><br clear="none" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;" id="yui_3_16_0_ym19_1_1478858311546_9088"><span style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;" id="yui_3_16_0_ym19_1_1478858311546_9089">&nbsp;&nbsp;</span><a shape="rect" href="https://github.com/apple/swift-evolution/blob/master/proposals/0100-add-sequence-based-init-and-merge-to-dictionary.md" target="_blank" style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;" id="yui_3_16_0_ym19_1_1478858311546_9090">https://github.com/apple/swift-evolution/blob/master/proposals/0100-add-sequence-based-init-and-merge-to-dictionary.md</a><span><br></span></div><div id="yui_3_16_0_ym19_1_1478858311546_9057"><span><br></span></div><div id="yui_3_16_0_ym19_1_1478858311546_9057"><span id="yui_3_16_0_ym19_1_1478858311546_9056">Thank you for the information. It looks like a good proposal.</span></div><div></div><div id="yui_3_16_0_ym19_1_1478858311546_9120">&nbsp;</div><div class="signature" id="yui_3_16_0_ym19_1_1478858311546_8978"><div id="yui_3_16_0_ym19_1_1478858311546_9121"><br></div>–Mr Bee<div id="yui_3_16_0_ym19_1_1478858311546_8980"><br></div></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" id="yui_3_16_0_ym19_1_1478858311546_9046" style="display: block;"> <div style="font-family: HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_ym19_1_1478858311546_9045"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_ym19_1_1478858311546_9044"> <div dir="ltr" id="yui_3_16_0_ym19_1_1478858311546_9043"><font size="2" face="Arial" id="yui_3_16_0_ym19_1_1478858311546_9042"> Pada Jumat, 11 November 2016 15:50, Martin R &lt;martinr448@gmail.com&gt; menulis:<br></font></div>  <br><br> <div class="y_msg_container" id="yui_3_16_0_ym19_1_1478858311546_9047">Nate Cook proposed merging dictionary initializers (with optional conflict resolution) to be added to the standard library:<br clear="none"><br clear="none">&nbsp; SE-0100 Add sequence-based initializers and merge methods to Dictionary<br clear="none">&nbsp; <a shape="rect" href="https://github.com/apple/swift-evolution/blob/master/proposals/0100-add-sequence-based-init-and-merge-to-dictionary.md" target="_blank" id="yui_3_16_0_ym19_1_1478858311546_9048">https://github.com/apple/swift-evolution/blob/master/proposals/0100-add-sequence-based-init-and-merge-to-dictionary.md</a><br clear="none"><br clear="none">Martin<br clear="none"><br clear="none"><br clear="none">&gt; On 11 Nov 2016, at 09:14, Ray Fix via swift-users &lt;<a shape="rect" ymailto="mailto:swift-users@swift.org" href="mailto:swift-users@swift.org">swift-users@swift.org</a>&gt; wrote:<br clear="none">&gt; <br clear="none">&gt; Hi Mr Bee,<br clear="none">&gt; <br clear="none">&gt; The reason I don’t think it is provided is because it is difficult to know what to do when keys collide.&nbsp; You could easily write such a thing and decide your own policy.&nbsp; For example:<br clear="none">&gt; <br clear="none">&gt; let d1 = ["Apples": 20, "Oranges": 13]<br clear="none">&gt; let d2 = ["Oranges": 3, "Cherries": 9]<br clear="none">&gt; <br clear="none">&gt; extension Dictionary {<br clear="none">&gt;&nbsp; &nbsp;  func merged(with another: [Key: Value]) -&gt; [Key: Value] {<br clear="none">&gt;&nbsp; &nbsp; &nbsp; &nbsp;  var result = self<br clear="none">&gt;&nbsp; &nbsp; &nbsp; &nbsp;  for entry in another {<br clear="none">&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  result[entry.key] = entry.value<br clear="none">&gt;&nbsp; &nbsp; &nbsp; &nbsp;  }<br clear="none">&gt;&nbsp; &nbsp; &nbsp; &nbsp;  return result<br clear="none">&gt;&nbsp; &nbsp;  }<br clear="none">&gt; }<br clear="none">&gt; <br clear="none">&gt; let result = d1.merged(with: d2)<br clear="none">&gt; <br clear="none">&gt; <br clear="none">&gt;&gt; On Nov 11, 2016, at 12:05 AM, Mr Bee via swift-users &lt;<a shape="rect" ymailto="mailto:swift-users@swift.org" href="mailto:swift-users@swift.org">swift-users@swift.org</a>&gt; wrote:<br clear="none">&gt;&gt; <br clear="none">&gt;&gt; Hi,<br clear="none">&gt;&gt; <br clear="none">&gt;&gt; I'm using Swift v3 on an El Capitan machine. I want to merge a dictionary into another compatible dictionary. However, I couldn't find addEntries function in the dictionary instance, like it was on NSMutableDictionary (<a shape="rect" href="https://developer.apple.com/reference/foundation/nsmutabledictionary" target="_blank">https://developer.apple.com/reference/foundation/nsmutabledictionary</a>). <br clear="none">&gt;&gt; <br clear="none">&gt;&gt; Does that mean that Swift standard library won't provide such similar function for native Swift dictionary? Or is there any other way of doing that natively? I mean using the built-in Swift's native dictionary function (<a shape="rect" href="https://developer.apple.com/reference/swift/dictionary" target="_blank">https://developer.apple.com/reference/swift/dictionary</a>), no need to write a custom function, or bridging to NSMutableDictionary.<br clear="none">&gt;&gt; <br clear="none">&gt;&gt; Thank you.<br clear="none">&gt;&gt; <br clear="none">&gt;&gt; Regards,<br clear="none">&gt;&gt; <br clear="none">&gt;&gt; –Mr Bee<br clear="none">&gt;&gt; <br clear="none">&gt;&gt; _______________________________________________<br clear="none">&gt;&gt; swift-users mailing list<br clear="none">&gt;&gt; <a shape="rect" ymailto="mailto:swift-users@swift.org" href="mailto:swift-users@swift.org">swift-users@swift.org</a><br clear="none">&gt;&gt; <a shape="rect" href="https://lists.swift.org/mailman/listinfo/swift-users" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><div class="yqt3154208410" id="yqtfd66134"><br clear="none">&gt; <br clear="none">&gt; _______________________________________________<br clear="none">&gt; swift-users mailing list<br clear="none">&gt; <a shape="rect" ymailto="mailto:swift-users@swift.org" href="mailto:swift-users@swift.org">swift-users@swift.org</a><br clear="none">&gt; <a shape="rect" href="https://lists.swift.org/mailman/listinfo/swift-users" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br clear="none"></div><br><br></div>  </div> </div>  </div></div></body></html>