Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

swift out of bound elelemnt

extension Collection {
    subscript(safe index: Index) -> Element? {
        return indices.contains(index) ? self[index] : nil
    }
}
Source by www.vadimbulavin.com #
 
PREVIOUS NEXT
Tagged: #swift #bound #elelemnt
ADD COMMENT
Topic
Name
1+8 =