https://github.com/devxoul/Fallback
💊 Syntactic sugar for Swift do-try-catch
https://github.com/devxoul/Fallback
Last synced: 4 months 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 (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-26T21:56:25.000Z (over 8 years ago)
- Last Synced: 2024-05-08T22:45:16.568Z (11 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
========
[](https://travis-ci.org/devxoul/Fallback)
[](https://cocoapods.org/pods/Fallback)
[](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.