Home

Awesome

JSButton

Version License Platform Language Twitter PRs Welcome

<img src="https://github.com/imjog/JSButton/blob/master/Example/jsbuttonss.png" width="300">

Demo

$ pod try JSButton

...or clone this repo and build and run/test the JSButton project in Xcode to see JSButton in action. If you don't have CocoaPods installed, grab it with [sudo] gem install cocoapods.

$ cd Example
$ pod install
$ open JSButton.xcworkspace

Requirements

Installation

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

pod "JSButton"

Manual Installation

Just drag the JSButton.swift files into your project.

IBDesignable

JSButton includes IBInspectable annotations to enable configuring the label inside Interface Builder. However, if you see these warnings when building...

IB Designables: Failed to update auto layout status: Failed to load designables from path (null)
IB Designables: Failed to render instance of JSButton: Failed to load designables from path (null)

...then you are likely using JSButton as a static library, which does not support IB annotations. Some workarounds include:

Usage

Creating a view from the storyboard

<img src='https://github.com/imjog/JSButton/blob/master/Example/jsbuttonclass.png' width='260' alt='Add JSButton to storyboard'>

<img src='https://github.com/imjog/JSButton/blob/master/Example/jsbuttondesignable.png' width='360' alt='Attributes inspector'> <img src='https://github.com/imjog/JSButton/blob/master/Example/jsbutton1.0.0-features.png' width='360' alt='Attributes inspector'>

Add action to button

To add action to your button just use .action you dont have to add Target and then handler function.

yourButton.action {
  print("Button Pressed!")
}

Author

<table> <tr> <td> <img src="https://avatars2.githubusercontent.com/u/20956124?s=400&u=01fab3fc9bb3d2ee799e314d3fe23c54d1deeb07&v=4" width="180"/>
 Jogendra Singh
<p align="center"> <a href = "https://github.com/imjog"><img src = "http://www.iconninja.com/files/241/825/211/round-collaboration-social-github-code-circle-network-icon.svg" width="36" height = "36"/></a> <a href = "https://twitter.com/imjog24"><img src = "https://www.shareicon.net/download/2016/07/06/107115_media.svg" width="36" height="36"/></a> <a href = "https://www.linkedin.com/in/jogendrasingh24/"><img src = "http://www.iconninja.com/files/863/607/751/network-linkedin-social-connection-circular-circle-media-icon.svg" width="36" height="36"/></a> </p> </td> </tr> </table>

What's next

Contribution

License

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