Skip to content
FaveButton is an iOS cute animated like button written in Swift.
Branch: master
Clone or download
Latest commit a729ba6 Jan 26, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
FaveButtonDemo Changing release version Sep 24, 2018
Source Patch for Swift 4.2 compatibility mode Nov 17, 2018
.gitignore
.swift-version
.travis.yml Defaulting travis build destination Sep 24, 2018
FaveButton.podspec
LICENSE
README.md
fave-button1.gif
fave-button2.gif Coordinating sparks ignite animations Jun 25, 2016

README.md

FaveButton

CocoaPods CocoaPods Carthage compatible codebeat badge Build Status Swift 4.2

Favorite Animated Button written in Swift

preview

Requirements

  • iOS 8.0+
  • Xcode 9+

Installation

For manual instalation, drag Source folder into your project.

os use CocoaPod adding this line to you Podfile:

pod 'FaveButton'

for Carthage users, add this line to you Cartfile

github "xhamr/fave-button"

Usage

With storyboard or xib files

  1. Create a Button that inherits from FaveButton

  2. Add Image for a Normal state

  3. Set the IBOutlet delegate property to a subclass of FaveButtonDelegate

  4. Optional manipulate porperties to change button settings

@IBInspectable public var normalColor:     UIColor
@IBInspectable public var selectedColor:   UIColor
@IBInspectable public var dotFirstColor:   UIColor
@IBInspectable public var dotSecondColor:  UIColor
@IBInspectable public var circleFromColor: UIColor
@IBInspectable public var circleToColor:   UIColor
  1. Optional respond to delegate methods
func faveButton(faveButton: FaveButton, didSelected selected: Bool)    
func faveButtonDotColors(faveButton: FaveButton) -> [DotColors]?     

In Code

let faveButton = FaveButton(
    frame: CGRect(x:200, y:200, width: 44, height: 44),
    faveIconNormal: UIImage(named: "heart")
)
faveButton.delegate = self
view.addSubview(faveButton)

Manipulating dot colors

If you want differents colors for dots like Twitter’s Heart Animation use the delegate method for the button you want.

func faveButtonDotColors(_ faveButton: FaveButton) -> [DotColors]? {
   if faveButton == myFaveButton{
	 // return dot colors
   }
   return nil
}

in FaveButtonDemo you will find a set of color to cause dots appear like this:

preview

Credits

FaveButton was inspired by Twitter’s Like Heart Animation within their App

License

FaveButton is released under the MIT license.

You can’t perform that action at this time.