You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
854 B
36 lines
854 B
//
|
|
// GMETextField.swift
|
|
// GME Remit
|
|
//
|
|
// Created by InKwon Devik Kim on 08/07/2019.
|
|
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class GMENumberTextField: UITextField {
|
|
private var customerNativeCountry: String?
|
|
var receiverNativeCountry: String = "" {
|
|
didSet {
|
|
selectKeyboardType()
|
|
}
|
|
}
|
|
|
|
required init?(coder aDecoder: NSCoder) {
|
|
super.init(coder: aDecoder)
|
|
|
|
keyboardType = .numberPad
|
|
|
|
customerNativeCountry = GMEDB.shared.user.string(.countryCode)
|
|
selectKeyboardType()
|
|
}
|
|
|
|
private func selectKeyboardType() {
|
|
guard let customerNativeCountry = customerNativeCountry else { return }
|
|
if customerNativeCountry == "KH" || receiverNativeCountry == "KH" {
|
|
keyboardType = .asciiCapable
|
|
} else {
|
|
keyboardType = .numberPad
|
|
}
|
|
}
|
|
}
|