Gifu/Source/Extensions/Array.swift

6 lines
115 B
Swift
Raw Normal View History

extension Array {
subscript(safe index: Int) -> Element? {
2017-07-02 22:19:42 +00:00
return indices ~= index ? self[index] : nil
}
}