spiegel-keyman/ios/engine/KMEI/KeymanEngine/Classes/Extension/Collection+SafeAccess.swift
2017-10-20 15:57:10 +07:00

13 lines
294 B
Swift

//
// Collection+SafeAccess.swift
// KeymanEngine
//
// Created by Gabriel Wong on 2017-10-13.
// Copyright © 2017 SIL International. All rights reserved.
//
extension Collection {
subscript (safe index: Index) -> Element? {
return indices.contains(index) ? self[index] : nil
}
}