Ordered map in Swift

前端 未结 12 1183
忘掉有多难
忘掉有多难 2020-11-28 09:24

Is there any built-in way to create an ordered map in Swift 2? Arrays [T] are sorted by the order that objects are appended to it, but dictionaries

12条回答
  •  再見小時候
    2020-11-28 10:06

    Swift does not include any built-in ordered dictionary capability, and as far as I know, Swift 2 doesn't either

    Then you shall create your own. You can check out these tutorials for help:

    • http://timekl.com/blog/2014/06/02/learning-swift-ordered-dictionaries/
    • http://www.raywenderlich.com/82572/swift-generics-tutorial

提交回复
热议问题