Created
August 5, 2016 09:47
-
-
Save dvlprliu/ede54918e8ce48d575324bdec7886526 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Identifiable { | |
associatedtype Identifier: Equatable | |
var id: Identifier { get } | |
} | |
extension CollectionType where Generator.Element: Identifiable { | |
func indexOf(element: Self.Generator.Element) -> Self.Index? { | |
return self.indexOf { $0.id == element.id } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment