ForceTouchActionSheet 0.2

ForceTouchActionSheet 0.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Mar 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Ivan Bruel.




ForceTouchActionSheet

ForceTouchActionSheet is a UI component to replicate iOS’s Springboard force touch on icons for shortcuts.

Example

Usage

class ViewController: UIViewController {

  @IBOutlet fileprivate weak var button: UIButton!
  fileprivate var forceTouchActionSheet: ForceTouchActionSheet?

  override func viewDidLoad() {
    super.viewDidLoad()
    let actions = [ForceTouchAction(icon: UIImage(named: "CameraIcon")!, title: "Action 1"),
                ForceTouchAction(icon: UIImage(named: "CameraIcon")!, title: "Action 2"),
                ForceTouchAction(icon: UIImage(named: "CameraIcon")!, title: "Action 3")]

    forceTouchActionSheet = ForceTouchActionSheet(view: button, actions: actions, completion: { index in
       print("clicked button \(button) \(index)")
    })
  } 
}

Reminder: ForceTouchActionSheet’s instance needs to be saved in order to manage the views.

Installation

ForceTouchActionSheet is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ForceTouchActionSheet'

License

ForceTouchActionSheet is available under the MIT license. See the LICENSE file for more info.