Created
October 30, 2019 09:33
-
-
Save Amzd/2b031dc7e9771de1c40d249c12914304 to your computer and use it in GitHub Desktop.
This file contains 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
extension Array where Element: Identifiable { | |
public subscript(id: Element.ID) -> Element? { | |
first { $0.id == id } | |
} | |
} | |
// let arrayOfIdentifiables = [] | |
// let itemWithId = arrayOfIdentifiables[id] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment