Tap gesture implementation for label rxswift

Problem: 

I want to implement the tap gesture to the label using rxswift. How to implement?


Solution:

Code:

        let tapGesture = UITapGestureRecognizer()

        lbl.addGestureRecognizer(tapGesture)

        lbl.isUserInteractionEnabled = true


        tapGesture.rx.event

            .subscribe(onNext: { [weak self] _ in

                self?.myfunc()

            })

            .disposed(bydisposeBag)


Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift