All Projects â†’ devxoul â†’ Fallback

devxoul / Fallback

Licence: mit
💊 Syntactic sugar for Swift do-try-catch

Programming Languages

swift
15916 projects

Fallback

Swift Build Status CocoaPods Carthage compatible

Syntactic sugar for Swift do-try-catch.

At a Glance

value = try fallback(
  try get("A"),
  try get("B"),
  try get("C"),
  try get("D")
)

is equivalent to:

do {
  value = try get("A")
} catch {
  do {
    value = try get("B")
  } catch {
    do {
      value = try get("C")
    } catch {
      value = try get("D")
    }
  }
}

Installation

  • Using CocoaPods:

    pod 'Fallback', '~> 0.2'
    
  • Using Carthage:

    github "devxoul/Fallback" ~> 0.2
    
  • Using Swift Package Manager:

    import PackageDescription
    
    let package = Package(
      name: "MyAwesomeProject",
      targets: [],
      dependencies: [
        .Package(url: "https://github.com/devxoul/Fallback.git", majorVersion: 0)
      ]
    )
    

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].