Files
Woka_Native_iOS/WOKA/Helpers/UIElements Helper/TextFieldPassword.swift
Bilal 32f9ddaa7d - Made the forget password UI.
- Made login view.
- Continue the flow from onboarding.
- added the flow from login-> create account and forget password.
2024-05-03 20:27:54 +05:30

34 lines
1.1 KiB
Swift

//
// TextFieldPassword.swift
// WOKA
//
// Created by Bilal on 03/05/2024.
//
import UIKit
extension UITextField {
fileprivate func setPasswordToggleImage(_ button: UIButton) {
if(isSecureTextEntry){
button.setImage(UIImage(named: "EyeOpenIcon"), for: .normal)
}else{
button.setImage(UIImage(named: "EyeCloseIcon"), for: .normal)
}
}
func enablePasswordToggle(){
let button = UIButton(type: .custom)
setPasswordToggleImage(button)
button.tintColor = UIColor.lightGray
button.contentEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 15)
button.frame = CGRect(x: CGFloat(self.frame.size.width - 25), y: CGFloat(5), width: CGFloat(25), height: CGFloat(25))
button.addTarget(self, action: #selector(self.togglePasswordView), for: .touchUpInside)
self.rightView = button
self.rightViewMode = .always
}
@IBAction func togglePasswordView(_ sender: Any) {
self.isSecureTextEntry = !self.isSecureTextEntry
setPasswordToggleImage(sender as! UIButton)
}
}