50 lines
2.1 KiB
Swift
50 lines
2.1 KiB
Swift
//
|
|
// EmailVM.swift
|
|
// WOKA
|
|
//
|
|
// Created by MacBook Pro on 29/04/24.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class EmailVM{
|
|
|
|
weak var vc : EmailVC!
|
|
|
|
func initView(){
|
|
let color1 = #colorLiteral(red: 0.144693464, green: 0.1426281333, blue: 0.6686832905, alpha: 1)
|
|
let color2 = #colorLiteral(red: 0.6901960784, green: 0.2745098039, blue: 0.7568627451, alpha: 1)
|
|
vc.nextBtn.applyGradient(colors: [color1, color2], startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0.8, y: 0))
|
|
vc.nextBtn.roundCorner()
|
|
vc.enterEmailTF.roundCorner()
|
|
|
|
// Set up text field delegate
|
|
vc.enterEmailTF.delegate = vc.self
|
|
|
|
vc.enterEmailTF.addRightButton(title: "", tintColor: UIColor.red, btnImage: UIImage(systemName: "exclamationmark.circle.fill"), target: self, action: #selector(validationIconTapped))
|
|
vc.enterEmailTF.rightView?.isHidden = true
|
|
|
|
self.vc.wokaLogoTopConstriant.constant = CheckPhoneHomeBtnOrNotch.shareInstance.topConstriant()
|
|
|
|
//Checking UserType to update the text
|
|
if AuthFunc.shareInstance.userType == .adult{
|
|
vc.enterEmailTF.placeholder = K.AuthenticationStringConstant.enterEmail.localized(loc: K.GVar.localized)
|
|
vc.emailVerifyLabel.isHidden = true
|
|
vc.beSafeLabel.text = K.AuthenticationStringConstant.safeAbove.localized(loc: K.GVar.localized)
|
|
vc.emailLabel.text = K.AuthenticationStringConstant.emailAbove.localized(loc: K.GVar.localized)
|
|
}else{
|
|
vc.enterEmailTF.placeholder = K.AuthenticationStringConstant.enterParentsEmail.localized(loc: K.GVar.localized)
|
|
vc.beSafeLabel.text = K.AuthenticationStringConstant.safeBelow.localized(loc: K.GVar.localized)
|
|
vc.emailLabel.text = K.AuthenticationStringConstant.emailBelow.localized(loc: K.GVar.localized)
|
|
}
|
|
}
|
|
|
|
// Function to handle tap on validation icon
|
|
@objc func validationIconTapped() {
|
|
let errorView = errorViews.object(forKey: vc.enterEmailTF)
|
|
if let errorView = errorView {
|
|
errorView.isHidden.toggle()
|
|
}
|
|
}
|
|
}
|