SafeIndex 1.0.0

SafeIndex 1.0.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Sep 2016
SPMSupports SPM

Maintained by Suyeol Jeon.


Downloads

Total1,899
Week127
Month459

Installs

Apps9
Apps WeekApps This Week 5
Test Targets1
Test WeekTests This week 1
powered by Segment

GitHub

Stars22
Watchers0
Forks2
Issues0
Contributors2
Pull Requests0

Code

Files1
LOCLines of Code 146


SafeIndex 1.0.0

  • By
  • Suyeol Jeon

SafeIndex

Optional Index for Swift.

At a Glance

let arr = ["A", "B", "C"]

arr[0]    // "A"
arr[100]  // fatal error: Array index out of range 😟

arr[^0]   // Optional("A")
arr[^100] // nil 😄

Installation

  • For iOS 8+ projects with CocoaPods:

    pod 'SafeIndex', '~> 1.0'
  • For iOS 8+ projects with Carthage:

    github "devxoul/SafeIndex" ~> 1.0
    
  • For iOS 7 projects with CocoaSeeds:

    github 'devxoul/SafeIndex', '1.0.0', :files => 'Sources/*.swift'
  • Using Swift Package Manager:

    import PackageDescription
    
    let package = Package(
      name: "MyAwesomeApp",
      dependencies: [
        .Package(url: "https://github.com/devxoul/SafeIndex", "1.0.0"),
      ]
    )

License

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