Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

mikaoj/EquatableArray

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

License

Stars

Watchers

Forks

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /