CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

EquatableArray 2.0.0

EquatableArray 2.0.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Dec 2016
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Joakim Gyllström.



  • By
  • Joakim Gyllstrom

EquatableArray

As of this writing (Swift 2.1) ordinary arrays can’t be Equatable. I wanted do do something likes this:

extension Array: Equatable where Element: Equatable {
    // Aaaww...no go, me so sad :'(
}

So I wrapped an array in EquatableArray instead, you can use it like this:

let stuff: EquatableArray = ["Hello", "No"]

And now I can pass it along to functions expecting an Equatable If you make it a var you can append/remove just as you would with an array:

var stuff: EquatableArray = ["Hello", "No"]
stuff.append("Yo!")
stuff.removeLast()

I’m sure Apple will fix this in a future version of Swift, but until then…

Requirements

Installation

EquatableArray is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "EquatableArray"

Author

Joakim Gyllström, [email protected]

License

EquatableArray is available under the MIT license. See the LICENSE file for more info.