pbchanges
This commit is contained in:
commit
1b116485e4
@ -298,14 +298,11 @@
|
||||
self.uiTextFieldDelegate = delegate;
|
||||
}
|
||||
|
||||
- (void)setWithMap:(nullable NSDictionary *)map bothDelegates:(nullable id<UITextFieldDelegate, MFTextFieldDelegate>)delegate {
|
||||
- (void)setWithMap:(nullable NSDictionary *)map {
|
||||
if (map.count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
[MVMCoreUICommonViewsUtility addDismissToolbar:self.textField delegate:delegate];
|
||||
[self setBothTextFieldDelegates:delegate];
|
||||
|
||||
NSString *string = [map string:KeyLabel];
|
||||
if (string.length > 0) {
|
||||
self.formText = string;
|
||||
@ -351,6 +348,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setWithMap:(nullable NSDictionary *)map bothDelegates:(nullable id<UITextFieldDelegate, MFTextFieldDelegate>)delegate {
|
||||
[MVMCoreUICommonViewsUtility addDismissToolbar:self.textField delegate:delegate];
|
||||
[self setBothTextFieldDelegates:delegate];
|
||||
[self setWithMap:map];
|
||||
}
|
||||
|
||||
- (void)setValidationBlock:(BOOL (^)(NSString * _Nullable))validationBlock {
|
||||
_validationBlock = validationBlock;
|
||||
[self valueChanged];
|
||||
@ -560,7 +563,11 @@
|
||||
if ([delegateObject isKindOfClass:[MVMCoreUIDelegateObject class]]) {
|
||||
[FormValidator setupValidationWithMolecule:self delegate:((MVMCoreUIDelegateObject *)delegateObject).formValidationProtocol];
|
||||
FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:((MVMCoreUIDelegateObject *)delegateObject).formValidationProtocol];
|
||||
[self setWithMap:json bothDelegates:formValidator];
|
||||
|
||||
[self setWithMap:json];
|
||||
self.mfTextFieldDelegate = formValidator;
|
||||
self.uiTextFieldDelegate = ((MVMCoreUIDelegateObject *)delegateObject).uiTextFieldDelegate;
|
||||
[MVMCoreUICommonViewsUtility addDismissToolbar:self.textField delegate:self.uiTextFieldDelegate];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,63 +8,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
@objc extension FormValidator: UITextFieldDelegate {
|
||||
public func textFieldDidEndEditing(_ textField: UITextField) {
|
||||
enableByValidation()
|
||||
if let delegate = delegate as? UITextFieldDelegate {
|
||||
delegate.textFieldDidEndEditing?(textField)
|
||||
}
|
||||
}
|
||||
|
||||
public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
||||
textField.resignFirstResponder()
|
||||
if let delegate = delegate as? UITextFieldDelegate {
|
||||
return delegate.textFieldShouldReturn?(textField) ?? true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
public func textFieldDidBeginEditing(_ textField: UITextField) {
|
||||
if let delegate = delegate as? UITextFieldDelegate {
|
||||
delegate.textFieldDidBeginEditing?(textField)
|
||||
}
|
||||
}
|
||||
|
||||
public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
|
||||
if let delegate = delegate as? UITextFieldDelegate {
|
||||
return delegate.textFieldShouldBeginEditing?(textField) ?? true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
public func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
|
||||
if let delegate = delegate as? UITextFieldDelegate {
|
||||
return delegate.textFieldShouldEndEditing?(textField) ?? true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
public func textFieldDidEndEditing(_ textField: UITextField, reason: UITextField.DidEndEditingReason) {
|
||||
if let delegate = delegate as? UITextFieldDelegate {
|
||||
delegate.textFieldDidEndEditing?(textField, reason: reason)
|
||||
}
|
||||
}
|
||||
|
||||
public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
|
||||
if let delegate = delegate as? UITextFieldDelegate {
|
||||
return delegate.textField?(textField, shouldChangeCharactersIn: range, replacementString: string) ?? true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
public func textFieldShouldClear(_ textField: UITextField) -> Bool {
|
||||
if let delegate = delegate as? UITextFieldDelegate {
|
||||
return delegate.textFieldShouldClear?(textField) ?? true
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@objc extension FormValidator: MFTextFieldDelegate {
|
||||
public func dismissFieldInput(_ sender: Any?) {
|
||||
if let delegate = delegate as? MFTextFieldDelegate {
|
||||
|
||||
@ -11,10 +11,12 @@ import UIKit
|
||||
open class MVMCoreUIDelegateObject: DelegateObject {
|
||||
public weak var formValidationProtocol: FormValidationProtocol?
|
||||
public weak var buttonDelegate: ButtonDelegateProtocol?
|
||||
|
||||
public weak var uiTextFieldDelegate: UITextFieldDelegate?
|
||||
|
||||
open override func setAll(withDelegate delegate: Any) {
|
||||
super.setAll(withDelegate: delegate)
|
||||
formValidationProtocol = delegate as? FormValidationProtocol
|
||||
buttonDelegate = delegate as? ButtonDelegateProtocol
|
||||
uiTextFieldDelegate = delegate as? UITextFieldDelegate
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user