Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

pelagornis/OBExtensions

Repository files navigation

OBExtensions

Swift

⚒ Library for more convenient optional binding.

Using

import

import OBExtensions

Use

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)") }

Installation

pod 'OBExtensions'
import PackageDescription

let package = Package(
  name: "MyApp",
  dependencies: [
    .Package(url: "https://github.com/Pelagornis/OBExtensions", branch: "main"),
 ]
)

License

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