⚒ Library for more convenient optional binding.
import OBExtensions
Before
var string: String?
guard let s = string else { return "" }
After
var string: String?
let s = string.obe(error: { return "" })
and
Before
if let s = string {
print("string :: \(s)")
} else {
fatalError()
}
After
let s = string.obe { print("string :: \($0)") }
- Using CocoaPods:
pod 'OBExtensions'
- Using Swift Package Manager:
import PackageDescription
let package = Package(
name: "MyApp",
dependencies: [
.Package(url: "https://github.com/Pelagornis/OBExtensions", branch: "main"),
]
)
OBExtensions is under MIT license. See the LICENSE file for more info.