0

I would like to intercept the value of the long press of this pod :

https://github.com/liyong03/YLLongTapShare

enter image description here

I am developing in Swift and this pod is only Objective-C.

I don't manage to catch the func that handle the end of the selection of the long press (here, on the screenshot), I would like to retrieve "Twitter" once the user has release the long press (and his choice was Twitter)

Thanks in advance !

Bonilla
  • 99
  • 2
  • 11
  • You mean that you didn't understood how to set the delegate method `longTapShareView:didSelectShareTo:withIndex:` or the closure `SelectedHandler`? – Larme Jun 26 '18 at 09:40
  • Hello Larme, glad to see your post again ! Yes, I think I don't know how to handle this with swift . – Bonilla Jun 26 '18 at 09:44
  • To be more precise, I would like to intercept for example the func touchesEnded func touchesEnded { print ("index value or item value \(index) or \(item.text)") //--> should capture "Twitter" } – Bonilla Jun 26 '18 at 09:53

1 Answers1

1
  1. In pod file uncomment use_frameworks! line, update pod, then build project
  2. Import 'YLLongTapShare' module in view controller
  3. Write rest of code:)

Simple example:

import UIKit
import YLLongTapShare
class TestViewController: UIViewController, YLLongTapShareDelegate {
    @IBOutlet weak var tapShareView: YLLongTapShareView!


override func viewDidLoad() {
    super.viewDidLoad()
    self.tapShareView.delegate = self;
    self.tapShareView.add(YLShareItem(icon: UIImage(named: "test1"), andTitle: "test1"))
    self.tapShareView.add(YLShareItem(icon: UIImage(named: "test2"), andTitle: "test2"))
    self.tapShareView.add(YLShareItem(icon: UIImage(named: "test3"), andTitle: "test3"))
}

func longTapShare(_ view: UIView!, didSelectShareTo item: YLShareItem!, with index: UInt) {
    print("longTapShare \(item.title)")
}

func colorOfShareView() -> UIColor! {
    return UIColor.red
}

}
Piotr Golinski
  • 990
  • 8
  • 19