Giter VIP home page Giter VIP logo

pmsuperbutton's Introduction

Icon

Language GitHub license Pod version Carthage Compatible

PMSuperButton is a powerful UIButton coming from the countryside, but with super powers! ๐Ÿ˜Ž

Icon
Icon
Icon

An easy way to create custom and complex buttons with custom attributes, directly added to the iOS Interface Builder, very easy to integrate into every project!

Top 100 Coolest Super Powers:

  • Edit everything directly from storyboard or code ๐Ÿ˜
  • Change border color, width
  • Customize the corner radius
  • Set a gradient background
  • Edit everything about the shadows: color, opacity, offset
  • Animations when the button is highlighted ๐Ÿค—
  • Animations when the button is selected
  • Ripple tap effect, where you can edit ripple color and ripple speed (like a Google Material button) ๐Ÿ˜ฎ
  • Toggle functionality
  • Image View content mode and alpha
  • Touch up inside closure ๐Ÿค 
  • Loader ๐Ÿคœ๐Ÿค›
  • Swift 3, 4 and Swift 5 support
  • and much more

How it works

The library allows you to use all the features of standard UIButton with a lot of new cool features, customizable from Storyboard or from code.

Icon

First of all, drag & drop a new UIButton inside your view controller in storyboard, then set the UIButton class to PMSuperButton:

Icon

That's it! Now you are ready to customize your PMSuperButton from the Attributes Inspector of Interface Builder.

How to use Touch Up Inside closure

IBAction or addTarget() with #selector? No thanks, we have a closure for this:

myButton.touchUpInside {
	print("This button was pressed!")
}
How to show the loader indicator
//Pass `false` to disable user interaction while loading is showed
myButton.showLoader(userInteraction: true)

//Hide loader
myButton.hideLoader()

Requirements

  • iOS 8.0+
  • Xcode 10+

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate PMSuperButton into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'PMSuperButton'

Then, run the following command:

$ pod install

Carthage


Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate PMSuperButton into your Xcode project using Carthage, specify it in your Cartfile:

github "pmusolino/PMSuperButton"

Run carthage update to build the framework and drag the built PMSuperButton.framework into your Xcode project.

Manually

  1. Download and drop /Sources folder in your project.
  2. Congratulations!

Swift compatibility

Contributing

  • If you need help or you'd like to ask a general question, open an issue.
  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Acknowledgements

Made with โค๏ธ by Paolo Musolino.

Follow me on:

๐Ÿ’ผ Linkedin

๐Ÿค– Twitter

๐ŸŒ‡ Instagram

๐Ÿ‘จ๐Ÿผโ€๐ŸŽค Facebook

MIT License

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

Made with โค๏ธ by Paolo Musolino.

pmsuperbutton's People

Contributors

banck avatar mixdesign avatar niorko avatar pmusolino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pmsuperbutton's Issues

Storyboard can't find PMSuperButton which integrated through Carthage

Hello!
I've placed UIButton in my storyboard and tried to type PMSuperButton in class, but there is no PMSuperButton. If wrote it there, then error:
Unknown class PMSuperButton in Interface Builder file.
But in .swift files I can import PMSuperButton , create and works with them.
Thanks!

Haptic Feedback on tap

Improvement: in iOS 10 we have a new API to provide feedback to the user. Haptic feedback is an extension to the visual feedback that every user is used to already. If you have an iPhone 7 or iPhone 7 Plus, you may have noticed a small vibration of the device while scrolling a date picker or when changing the value of a switchโ€”that's haptic feedback. The new UIFeedbackGenerator class can be used to implement the same behavior in your apps.

Swift Package Manager error

When using SPM to get the library in Xcode I got this error :
Screenshot 2020-02-15 at 16 52 31

I fixed it by not specifying a version number for the package but by directly pulling the master branch. It would be better to get it working with versions numbers (for example 3.0.0 < 4.0.0).

Loader issue

Hello!
There is an issue with show/hide loader when less than 0.5 seconds have passed with the showLoader() call.
Because you add indicator after 0.5 second in showLoader() method:

UIView.transition(with: self, duration: 0.5, options: .curveEaseOut, animations: {
            self.titleLabel?.alpha = 0.0
            self.imageAlpha = 0.0
        }) { (finished) in
            self.addSubview(self.indicator)
            self.indicator.startAnimating()
        }

And in hideLoader you have this code:

open func hideLoader(){
        guard self.subviews.contains(indicator) == true else {
            return
        }

No shadow, background image and animation when added programatically

Hi,
I'm adding buttons programatically. This is what I have and I can't seem to get the background image, shadow and animation working. All works when I add a button in storyboard view.

            let button = PMSuperButton() //UIButton()
            let bgrImage = UIImage(named: "someImage")
            //button.setImage(bgrImage, for: .normal) //-> this works ok
            button.setBackgroundImage(bgrImage, for: UIControl.State.normal)
            

            button.shadowColor = UIColor.gray
            button.shadowOffset = CGSize(width: 2, height: 2)
            button.shadowRadius = 2
            button.shadowOpacity = 2
            button.animatedScaleWhenSelected = 1
            button.animatedScaleWhenHighlighted = 1
            button.animatedScaleDurationWhenSelected = 1
            button.animatedScaleDurationWhenHighlighted = 1

Any idea what am I doing wrong?

Adding file manually to project results in build errors

Add file manually to project

The following errors appear for each open var:
Overriding declaration requires an 'override' keyword
Overriding non-open var outside of its defining module

xcode: Version 10.1 (10B61)
swift: version 4.2.1

not able to do button programmatically

` let myFirstButton = PMSuperButton.self

    myFirstButton.setTitle("โœธ", for: .normal)
        myFirstButton.setTitleColor(.blue, for: .normal)
        myFirstButton.frame = CGRect(x: 15, y: -50, width: 300, height: 500)
        myFirstButton.addTarget(self, action: #selector(pressed), for: .touchUpInside)

`

Here's my code, it's probably pretty nubby. Just trying to find a way to programmtically add the button and edit it with your creation.

Feature Suggest: Haptic Feedback

Hi @pmusolino I saw your framework PMSuperButton, its quite interesting. I know this repo had been inactive for a bit long, but why not provide it a new life. Actually I am really interested in contribution into the repo. I have an amazing feature for your PMSuperButton. With the immense improvement in UX Apple brought Haptic Feedback into their phones, so why not use that exceptional feature into your framework. It will be really amazing. This small piece of addition will really help to advance your framework.

With this we can start redesigning this framework. We can add various new features which this framework is lagging. So if you are interested in adding Haptic Feedback do tell me, I will create a PR and Push the file.

Do give a response, this will help me to know the status, so that I can work further on this project.

I have the code ready, ts just your approval and I can make an PR.

PMSuperButton not working

Hi,

I have created a UIButton and added the PMSuperButton class, it does show the Super Button inspector properties, in the preview it also renders the changed property. But once build to the device nothing shows up.

Any ideas?

Thanks,

Niels

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.