Open jriosdev opened 3 years ago
@jriosdev Thank you.
In order to resend code, set footerTitle
and then make the shouldFooterBehaveAsButton
property true
. On tapping the footer, the below delegate method will be called:
func didTap(footer button: UIButton, from viewController: BJOTPViewController) {
/**
* This delegate method will get called when the footer button at the bottom is tapped. Use this to resend one time code from the server.
*
* This method will only be called when the `shouldFooterBehaveAsButton` is `true`.
*
* - Parameter button: The button that's tapped.
* - Parameter viewController: The otp view controller. Use this to show loaders, spinners, present any other view controllers on top etc..
*
* - Author: Badhan Ganesh
*/
}
For the timer part, you could easily use an NSTimer
object and then assign footerTitle
a new string every second; the UI will be updated automatically upon assignment. I'm leaving this (timer) implementation to the devs who are using the view controller. 🙂 I think it is best when implemented by the ones who are using it based on their requirements.
Feel free to let me know if you face any other issue(s). Thanks again.
UPDATE:
I'm adding the enhancement label and will surely consider implementing the feature in a future release. But for now, the resend timer can be easily added with a few lines of code.
you did good work There is no resend code time please add that too