- iOS 10.0+
- Xcode 11.0+
- Swift 5.0+
SweetLike is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SweetLike'
Create,
on storyboard:
@IBOutlet weak var sweetLikeButton: SweetLike!
or programmatically:
let sweetLikeButton = SweetLike()
To get like and unlike actions,
with completion:
sweetLikeButton.likeAction = {}
sweetLikeButton.unlikeAction = {}
with delegate(SweetLikeDelegate):
func likeAction() {}
func unlikeAction() {}
There are a few properties you may change:
Property | Description | Type | Default Value |
---|---|---|---|
IBInspectable likedImage | The image that shows when liked | UIImage | named: likedAsset |
IBInspectable unlikedImage | The image that shows when unliked | UIImage | named: unlikedAsset |
IBInspectable likedColor | The color of the default liked image | UIColor | UIColor(red: 201/255, green: 97/255, blue: 80/255, alpha: 1) |
IBInspectable unlikedColor | The color of the default unliked image | UIColor | UIColor(red: 201/255, green: 97/255, blue: 80/255, alpha: 1) |
likeActionAnimationDuration | The duration of like animation | Double | 0.6 |
unlikeActionAnimationDuration | The duration of unlike animation | Double | 0.15 |
isAnimationEnabled | The boolean that states the animating enabled or disabled | Bool | true |
Yusuf Demirci, [email protected]
SweetLike is available under the MIT license. See the LICENSE file for more info.