Swiftpack.co - devxoul/SafeCollection as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by devxoul.
devxoul/SafeCollection 3.1.0
Safe Collection for Swift
⭐️ 42
🕓 4 years ago
iOS macOS tvOS
.package(url: "https://github.com/devxoul/SafeCollection.git", from: "3.1.0")

SafeCollection

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 😟

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

Installation

  • 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: "https://github.com/devxoul/SafeCollection", .upToNextMajor(from: "3.0.0")),
      ]
    )
    

License

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

GitHub

link
Stars: 42
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

3.1.0
4 years ago
  • Add Swift 5 support 🚀 (#5)

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics