jegnux / Needs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Needs

Version License Platform

Needs is a small library that let you use a property wrapper to automatically call setNeeds- methods. It works out-of-the-box for all setNeeds- methods available on UIView, UIViewController and NSView. If you need to you can also extend it with your own Need.

Requirements

  • iOS 9.0+ / macOS 10.10+
  • Swift 5.2

Installation

Needs is available through CocoaPods and SwiftPM

Example

Add a Needs property wrapper to one of your properties to call automatically the desired setNeeds- method

@Needs(.layout, .display)
var progress: CGFloat = 0

Available needs

.display            // self.setNeedsDisplay()
.layout             // self.setNeedsLayout()
.updateConstraints  // self.setNeedsUpdateConstraints()
.focusUpdate        // self.setNeedsFocusUpdate()
.statusBarAppearanceUpdate                    // self.setNeedsStatusBarAppearanceUpdate()
.updateOfHomeIndicatorAutoHidden              // self.setNeedsUpdateOfHomeIndicatorAutoHidden()
.updateOfScreenEdgesDeferringSystemGestures   // self.setNeedsUpdateOfScreenEdgesDeferringSystemGestures()
.updateOfPrefersPointerLocked                 // self.setNeedsUpdateOfPrefersPointerLocked()
.userInterfaceAppearanceUpdate                // self.setNeedsUserInterfaceAppearanceUpdate()
.focusUpdate                                  // self.setNeedsFocusUpdate()
.viewDisplay                                  // self.viewIfLoaded?.setNeedsDisplay()
.viewLayout                                   // self.viewIfLoaded?.setNeedsLayout()
.updateViewConstraints                        // self.viewIfLoaded?.setNeedsUpdateConstraints()
.reloadData                                   // self.tableView.reloadData()
.display           // self.setNeedsDisplay($0.bounds)
.layout            // self.needsLayout = true
.updateConstraints // self.needsUpdateConstraints = true

Author

Jérôme Alves

License

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

About

License:MIT License


Languages

Language:Swift 90.8%Language:Ruby 9.2%