Gifu/Source/Extensions/Array.swift

6 lines
115 B
Swift

extension Array {
subscript(safe index: Int) -> Element? {
return indices ~= index ? self[index] : nil
}
}