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

Overview

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.

Comments
  • Fixed an issue where button's setTitle(string:state:) did not respond  to a title change.

    Fixed an issue where button's setTitle(string:state:) did not respond to a title change.

    Hi, @Codeido Thanks for accepting my PR.

    We have a problem in previous PR's implementation ๐Ÿ˜ถ: Everythings works OK if the developer configures the button only through the storyboard. But, if there is a need to change the title of the button programmatically, then a problem arises:

    button.setTitle("Button title", for: .normal) // Won't change the title
    

    The cause of the problem was the getAttributedString() method, which always returned the value .attributedText and ignored the value of .text;

    I fixed the issue. Now we have a flexible function:

    // Get the NSMutableAttributedString with kern value: optional("string") ?? "";
    // Button's previous attributedText is kept, only mutableString value is changed.
    private func getAttributedString(with string:String?, letterSpacing spacing:CGFloat) -> NSMutableAttributedString {
        var attr:NSMutableAttributedString!
        if let string = string, let attrText = self.titleLabel?.attributedText {
            let attrString = NSMutableAttributedString(attributedString:attrText)
            attrString.mutableString.setString(string)
            attr = attrString
        } else {
            attr = NSMutableAttributedString(string:string ?? "")
        }
        
        attr.addAttribute(NSAttributedStringKey.kern, value: spacing, range: NSRange(location: 0, length: attr.length))
        return attr
    }
    

    In the future PR with another attributed string features, we may create another common private function which will return titleLabel's NSMutableAttributedString with a single string parameter.

    Thanks!

    opened by mixdesign 7
  • Storyboard can't find PMSuperButton which integrated through Carthage

    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!

    help wanted 
    opened by Banck 5
  • Having build issue for Storyboard with latest Xcode

    Having build issue for Storyboard with latest Xcode

    You can find more about it here.

    https://stackoverflow.com/questions/39732312/xcode-8-ib-designables-failed-to-render-and-update-auto-layout-status-the-a

    question 
    opened by allnash 3
  • Adding file manually to project results in build errors

    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

    help wanted 
    opened by wousser 2
  • Method myButton.showLoader() does not hide text while loading

    Method myButton.showLoader() does not hide text while loading

    I'm trying to use the method showLoader(), the loader appears and spins but the text does not hide as shown in the example in the first part of https://github.com/pmusolino/PMSuperButton.

    help wanted 
    opened by patopipp 2
  • Rounded button with shadow and gradient

    Rounded button with shadow and gradient

    Rounded button with shadow and gradient doesn't show up properly.

    obrazok aplikacie spravy 2134338174

    If I set clipToBounds to true, button is rounded, but shadow disappears (obviously).

    enhancement 
    opened by niorko 2
  • PMSuperButton not working

    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

    help wanted 
    opened by tsukasa1989 1
  • Adding new inspectable attribute

    Adding new inspectable attribute "letterSpacing".

    Hi, Really love this button. Tried a lot of other buttons out there, but I've found this one special, because of rounded borders ๐Ÿ˜‰

    I think buttons with letter spacings look nice and modern. So, I thought it would be handy to have it in PMSuperButton.

    main storyboard 2017-10-16 19-07-10

    opened by mixdesign 1
  • not able to do button programmatically

    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.

    opened by JorgeAntonio512 0
  • Feature: Haptic Feedback added

    Feature: Haptic Feedback added

    Major Feature (Haptic Feedback)

    • In this push haptic feedback feature is added.
    • Other than that no codes are changed.
    • Since haptic feedback is available from iOS 10 so I had added a security check for iOS detection in the code.
    • Indentation is followed
    • No empty line left
    • Markdown provided
    • code is simplified, at most possible

    @pmusolino do have a look and if possible do merge it. If you find any changes do ping me happy to correct it.

    Happy Coding Gokul Nair

    enhancement 
    opened by gokulnair2001 4
  • Feature Suggest: Haptic Feedback

    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.

    opened by gokulnair2001 2
  • Swift Package Manager error

    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).

    opened by marcheimendinger 2
  • No shadow, background image and animation when added programatically

    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?

    help wanted 
    opened by perunworks 2
Releases(3.0.2)
Owner
Paolo Musolino
Full remote iOS Software Engineer with more than 8 years of experience in the iOS platform. Heart and soul in every line of code.
Paolo Musolino
UIButton sublass for loading and transition animation.

TransitionButton Concept Source: Dribbble Preview Expand animation: Shake animation: Example To run the example project, clone the repo, then open the

null 1.4k Dec 25, 2022
UIButton-based view with fade in/out animation features

JTFadingInfoView Overview JTFadingInfoView is google's material design like notification view with smooth fade in/out animation features, based on UIB

Junichi Tsurukawa 129 Mar 19, 2022
Custom UIButton effect inspired by Google Material Design

ZFRippleButton iOS Custom UIButton effect inspired by Google Material Design written in Swift Usage Set the UIButton class in Nib to ZFRippleButton or

Amornchai Kanokpullwad 1.4k Dec 1, 2022
A fully customisable swift subclass on UIButton which allows you to create beautiful buttons without writing any line of code.

JSButton 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 ha

Jogendra 12 May 9, 2022
A small and flexible (well documented) UIButton subclass with animated loading progress, and completion animation.

ButtonProgressBar-iOS Example For LIVE PREVIEW on Appetize in your browser itself, click here. To run the example project, clone the repo, and run pod

Pushkar Sharma 566 Dec 9, 2022
Full-featured IBDesignable UIButton class

SpicyButton Full-featured IBDesignable UIButton class Installation Add the following to your project's Podfile: pod 'SpicyButton' Usage You can easily

Luke Crum 2 Sep 6, 2022
A Custom UIButton with Centralised Styling and common styles available in Interface Builder

DesignableButton DesignableButton is a UIButton subclass that uses a centralised and reusable styling. In InterfaceBuilder, drag and drop a Designable

Idle Hands Apps 93 Aug 14, 2022
Extensions giving Swift's Codable API type inference super powers ๐Ÿฆธโ€โ™‚๏ธ๐Ÿฆนโ€โ™€๏ธ

Welcome to Codextended โ€” a suite of extensions that aims to make Swiftโ€™s Codable API easier to use by giving it type inference-powered capabilities an

John Sundell 1.4k Jan 2, 2023
A macOS Monterey Patcher that will be coming soon.

A macOS Monterey UI patcher. It uses my MontereyPatcher-CLI patcher as its base, and it will hopefully build upon that. Resources: MontereyPatcher-CLI

Solomon Wood 11 Aug 18, 2021
๐Ÿ“ฑ๐Ÿ“ฒ Navigate between view controllers with ease. ๐Ÿ’ซ ๐Ÿ”œ More stable version (written in Swift 5) coming soon.

CoreNavigation ?? ?? Navigate between view controllers with ease. ?? ?? More stable version (written in Swift 5) coming soon. Getting Started API Refe

Aron Balog 69 Sep 21, 2022
Flip is a book tracking app built for iOS and iPadOS. Coming soon to watchOS and macOS.

Flip Flip is a project aimed at helping users manage their library of books. It has a clean user interface, allows users to sort and filter their libr

Jesal 4 Dec 8, 2022
Codable, but with Super power made custom Codable behavior easy.

Codable, but with Super power made custom Codable behavior easy.

Tsungyu Yu 24 Aug 30, 2022
Tranquillity is a lightweight but powerful dependency injection library for swift.

DITranquillity Tranquillity is a lightweight but powerful dependency injection library for swift. The name "Tranquillity" laid the foundation in the b

Ivlev Alexander 393 Dec 24, 2022
Marshroute is an iOS Library for making your Routers simple but extremely powerful

Marshroute Contents Overview Detailes Tuning the transition animation 3d touch support PeekAndPopUtility Peek and pop state observing Demo Requirement

avito.tech 215 Jan 4, 2023
A Lightweight But Powerful Color Kit (Swift)

BCColor A lightweight but powerful color kit (Swift) Features Pick Colors From Image Generate Monochrome Image Support Hex Color Style Lighten / Darke

Xiaobo Zhang 418 Nov 25, 2022
A simple, but powerful UI patcher for macOS Big Sur designed for everyone.

What is Patched Sur? Patched Sur is a UI patcher for macOS Big Sur, designed to make it easy to run macOS 11 on unsupported Macs. This patcher hopes t

Ben 274 Dec 24, 2022
A lightweight but powerful network library with simplified and expressive syntax based on AFNetworking.

XMNetworking English Document XMNetworking ๆ˜ฏไธ€ไธช่ฝป้‡็š„ใ€็ฎ€ๅ•ๆ˜“็”จไฝ†ๅŠŸ่ƒฝๅผบๅคง็š„็ฝ‘็ปœๅบ“๏ผŒๅŸบไบŽ AFNetworking 3.0+ ๅฐ่ฃ…ใ€‚ ๅ…ถไธญ๏ผŒXM ๅ‰็ผ€ๆ˜ฏๆˆ‘ไปฌๅ›ข้˜Ÿ Xcode-Men ็š„็ผฉๅ†™ใ€‚ ็ฎ€ไป‹ ๅฆ‚ไธŠๅ›พๆ‰€็คบ๏ผŒXMNetworking ้‡‡็”จไธญๅฟƒๅŒ–็š„่ฎพ่ฎกๆ€ๆƒณ

KANGZUBIN 981 Dec 29, 2022
Cybr/Secure - A simple but powerful secure password generator

A simple but powerful secure password generator. You get the option of password length (10 to 20 characters) and whether you include numbers, symbols, uppercase and/or lowercase letters. Simply tap the lock icon to generate a secure password and then tap to copy the password.

Mykel Agathos 1 Feb 16, 2022
Super powerful remote config utility written in Swift (iOS, watchOS, tvOS, OSX)

Mission Control Super powerful remote config utility written in Swift (iOS, watchOS, tvOS, OSX) Brought to you by Have you ever wished you could chang

appculture 113 Sep 9, 2022
AwaitKit is a powerful Swift library which provides a powerful way to write asynchronous code in a sequential manner.

AwaitKit is a powerful Swift library inspired by the Async/Await specification in ES8 (ECMAScript 2017) which provides a powerful way to write asynchronous code in a sequential manner.

Yannick Loriot 752 Dec 5, 2022