Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devxoul/Fallback
💊 Syntactic sugar for Swift do-try-catch
https://github.com/devxoul/Fallback
Last synced: about 1 month ago
JSON representation
💊 Syntactic sugar for Swift do-try-catch
- Host: GitHub
- URL: https://github.com/devxoul/Fallback
- Owner: devxoul
- License: mit
- Archived: true
- Created: 2016-10-26T09:19:40.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-26T21:56:25.000Z (about 8 years ago)
- Last Synced: 2024-05-08T22:45:16.568Z (8 months ago)
- Language: Swift
- Homepage:
- Size: 11.7 KB
- Stars: 44
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - Fallback - Syntactic sugar for nested do-try-catch. (Code Quality)
- awesome-ios-star - Fallback - Syntactic sugar for nested do-try-catch. (Code Quality)
README
Fallback
========![Swift](https://img.shields.io/badge/Swift-3.0-orange.svg)
[![Build Status](https://travis-ci.org/devxoul/Fallback.svg?branch=master)](https://travis-ci.org/devxoul/Fallback)
[![CocoaPods](http://img.shields.io/cocoapods/v/Fallback.svg)](https://cocoapods.org/pods/Fallback)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)Syntactic sugar for Swift do-try-catch.
## At a Glance
```swift
value = try fallback(
try get("A"),
try get("B"),
try get("C"),
try get("D")
)
```is equivalent to:
```swift
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](https://cocoapods.org)**:
```ruby
pod 'Fallback', '~> 0.2'
```- **Using [Carthage](https://github.com/Carthage/Carthage)**:
```
github "devxoul/Fallback" ~> 0.2
```- **Using [Swift Package Manager](https://swift.org/package-manager)**:
```swift
import PackageDescriptionlet 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](LICENSE) file for more info.