Latest 0.1.1
Homepage https://github.com/yagiz/BubbleButton
License MIT
Platforms ios 10.0
Authors

BubbleButton is a Swift 3 UIButton subclass which produces fancy bubbles when it’s tapped.

N|Solid

Installation

CocoaPods

pod 'BubbleButton', '~> 0.1.1'

Manually

Just download or clone the repo and move BubbleButton.swift file to your project.

Usage

Interface Builder

In Interface Builder you can set BubbleButton to Custom Class property of your button. Just do not forget the module field. Then you can customize its properties.

N|Solid

By Code

button = BubbleButton(frame: CGRect(x: 0, y: 0, width: 200, height: 50))
button.backgroundColor = UIColor.gray
button.bubbleColor = UIColor.red
button.bubbleCount = 5
..
self.view.addSubview(button)

Starting and Ending Animation

You can start animating button after it’s tapped. After your progress is completed you can call "endAnimationWith" to reset button state.

@IBAction func buttonAction(_ sender: AnyObject) {
    bubbleButton.startBubbleAnimationWith(direction: .TopRight)
    print("startingAnimation")

    DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
        print("endingAnimation")

        self.bubbleButton.endAnimationWith {
            print("animationIsEnded")
        }
    }
}

Customize

You can customize these properties in Interface Builder or by code:

Properties

titleForProgress:String
titleForCompletion:String

endAnimationDuration:Float
fadeOutAnimationDelay:Float
fadeOutAnimationDuration:Float

bubbleColor:UIColor
bubbleCount:Int

bubbleSpeedMin:CGFloat
bubbleSpeedMax:CGFloat

bubbleRadiusMin:CGFloat
bubbleRadiusMax:CGFloat

Direction

direction argument of startBubbleAnimationWithdetermines where bubbles move to.

public enum BubbleDirection
{
    case Top
    case Left
    case Bottom
    case Right

    case TopLeft
    case TopRight
    case BottomLeft
    case BottomRight
}

License

MIT

Free Software, Hell Yeah!

Latest podspec

{
    "name": "BubbleButton",
    "version": "0.1.1",
    "summary": "By far the most fantastic view I have seen in my entire life. No joke.",
    "description": "This fantastic view changes its color gradually makes your app look fantastic!",
    "homepage": "https://github.com/yagiz/BubbleButton",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Yagiz": "[email protected]"
    },
    "source": {
        "git": "https://github.com/yagiz/BubbleButton.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "BubbleButton/BubbleButton.swift",
    "pushed_with_swift_version": "3"
}

Pin It on Pinterest

Share This