SafeCollection 3.1.0

SafeCollection 3.1.0

Maintained by Suyeol Jeon.

  • By
  • Suyeol Jeon


Swift Build Status CocoaPods Carthage compatible

SafeCollection provides a safer way to deal with subscripts. Inspired by Swift's LazyCollection.

At a Glance

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

arr[0]    // "A"
arr[100]  // fatal error: Array index out of range 😟[0]   // Optional("A")[100] // nil 😄


  • For iOS 8+ projects with CocoaPods:

    pod 'SafeCollection'
  • For iOS 8+ projects with Carthage:

    github "devxoul/SafeCollection"
  • Using Swift Package Manager:

    import PackageDescription
    let package = Package(
      name: "MyAwesomeApp",
      dependencies: [
        .package(url: "", .upToNextMajor(from: "3.0.0")),


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