Last active
August 8, 2016 20:20
-
-
Save jpmhouston/f25d560cbd771d0f74f3d7b2d0ce6fbd to your computer and use it in GitHub Desktop.
Swift Array element(at:), why is this missing from the standard library?
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
extension Array { | |
func element(at index: Int) -> Element? { | |
return index >= 0 && index < count ? self[index] : nil | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment