MPButton 0.1.3

MPButton 0.1.3

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Apr 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Marcos Palacios.



MPButton 0.1.3

  • By
  • btadine

MPButton

Have you ever tried to edit the constraints of the elements inside a UIButton? Adding new elements without breaking existing layout? Just make the touchable area bigger?

MPButton is a lightweight class that decorates any UIView adding UIControlEvents (ie. touchUpInside) and customizable touching area. This way, you only need to care about the UI.

As easy as this:

let button = MPButton(decoratedView: MyView(), hitbox: CGSize(width: 250, height: 90))
button.addTarget(self, action: #selector(self.doSomething), for: .touchUpInside)

button.decoratedView.myViewLabel.text = "No need to cast"

Example

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

Installation

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

pod "MPButton"

Author

btadine

License

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