Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EquatableArray

CI Status Version License Platform

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, joakim@backslashed.se

License

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

About

An equatable array in Swift

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages