Skip to content

Latest commit

 

History

History
90 lines (67 loc) · 2.28 KB

README.md

File metadata and controls

90 lines (67 loc) · 2.28 KB

BlueIntentCore

CI Status Swift Package Manager Version License Platform

  • Short way to unwrap optional value for Swift.
  • Use BlueIntentExtension proxy as customization point for constrained protocol extensions.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

BlueIntentCore is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'BlueIntentCore'

Usage

import BlueIntentBase

unwrap optional value

let string: String? = "test"
    
// unwrap
string.let { it in
  // it is wrapped value
}

// unwrap, with default value
string = string.let {
  return "test"
} let: { it in
  // it is wrapped value
}

Use BlueIntentExtension proxy as customization point for constrained protocol extensions

extension String: BlueIntentCompatible { }

extension BlueIntentExtension where Base == String {
  public var length: Int {
    return base.count
  }
}

let string = "test"
string.bi.length

BlueIntentExtension & Unwrap

let string: String? = "test"
    
// unwrap
string?.bi.let { it in
// it is wrapped value
  XCTAssert(it == "test")
}

Manually

make

Author

qiuzhifei, [email protected]

References

License

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