Skip to content

migue1s/SafeArrays

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SafeArrays

[![CI Status](http://img.shields.io/travis/Miguel Saiz/SafeArrays.svg?style=flat)](https://travis-ci.org/Miguel Saiz/SafeArrays) Version License Platform

Usage

On normal swift arrays, subscript them with the word "safe:", if bounds checking fails, then it will return nil.

Example

let testArray = [1,2,3]

// Will return nil
testArray[safe: 4]

// Will crash the app with an "array out of bounds exception".
testArray[4]

Installation

SafeArrays is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SafeArrays"

Author

Miguel Saiz, miguelsaizo@gmail.com

License

SafeArrays is available under the MIT license. See the LICENSE file for more info.