Skip to content
This repository has been archived by the owner on Mar 29, 2019. It is now read-only.
/ Fallback Public archive

💊 Syntactic sugar for Swift do-try-catch

License

Notifications You must be signed in to change notification settings

devxoul/Fallback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

💊 Syntactic sugar for Swift do-try-catch

Resources

License

Stars

Watchers

Forks

Packages

No packages published