Swiftpack.co - MTattin/FABoLLFlickableButton as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by MTattin.
MTattin/FABoLLFlickableButton 2.0.0
Flickable UIButton
⭐️ 1
🕓 2 years ago
iOS
.package(url: "https://github.com/MTattin/FABoLLFlickableButton.git", from: "2.0.0")

FABoLLFlickableButton

You can add flick action to UIButton.
If you use FABoLLFlickableButton, you can receive callback from swipe gestures.

License

MIT

Dependency

  • iOS, >=14
  • Xcode, >= 13

Usage

///
/// An appeared view when you swipe up
///
let up: UILabel = UILabel.init()
up.backgroundColor = UIColor.brown
up.textColor = UIColor.white
up.textAlignment = NSTextAlignment.center
up.text = "UP"
///
/// An appeared view when you swipe down
///
let down: UILabel = UILabel.init()
down.backgroundColor = UIColor.clear
down.textAlignment = NSTextAlignment.center
down.text = "⚡️"
///
/// An appeared view when you swipe left
///
let left: UIImageView = UIImageView
    .init(image: UIImage.init(named: "star")!
    .withRenderingMode(UIImage.RenderingMode.alwaysTemplate))
left.tintColor = UIColor.red
///
/// An appeared view when you swipe right
///
let right: UIImageView = UIImageView.init(image: UIImage.init(named: "star")!)
right.backgroundColor = UIColor.blue
right.clipsToBounds = true
right.layer.cornerRadius = self.button.frame.size.width * 0.5
///
/// Add flick actions
///
self.button.setFlickable(
    settings: FABoLLFlickableButtonSettings.init(
        views: (
            up: up,
            left: left,
            down: down,
            right: right
        ),
        margins: (
            up: 5.0,
            left: 10.0,
            down: 5.0,
            right: 10.0
        ),
        animationDuration: nil
    ),
    callbackUp: {
        print("up")
    },
    callbackLeft: {
        print("left")
    },
    callbackDown: {
        print("down")
    },
    callbackRight: {
        print("right")
    }
)

GitHub

link
Stars: 1
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics