Skip to content

p-x9/FoundationModifier

Repository files navigation

FoundationModifier

Allows Foundation classes to be write by method chains.

Example

  • NSMutableAttributedString
let attributedString: NSMutableAttributedString = .init(string: "Hello")^
        .addAttribute(.backgroundColor, value: UIColor.red.cgColor, range: .init(location: 1, length: 1))
        .addAttribute(.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: .init(location: 0, length: 5))
        .addAttribute(.foregroundColor, value: UIColor.yellow, range: .init(location: 2, length: 3))
  • UserDefaults
let userDefaults: UserDefaults = .standard^
        .set("Hello", forKey: "hello")
        .set(0, forKey: "0")
  • ...

About

🚃 Allows `Foundation` classes to be write by method chains.

Resources

License

Stars

3 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors