reivew
This commit is contained in:
parent
fcb377df33
commit
4ef662d1ca
@ -16,12 +16,21 @@ import UIKit
|
|||||||
var fieldKey: String?
|
var fieldKey: String?
|
||||||
var formValue: Bool?
|
var formValue: Bool?
|
||||||
var isRequired: Bool = false
|
var isRequired: Bool = false
|
||||||
var radioButtonModel: RadioButtonModel?
|
|
||||||
|
|
||||||
lazy var radioGroupName: String? = {
|
lazy var radioGroupName: String? = {
|
||||||
[unowned self] in
|
[unowned self] in
|
||||||
return json?.optionalStringForKey("radioGroupName") ?? json?.optionalStringForKey("fieldKey")
|
return json?.optionalStringForKey("radioGroupName") ?? json?.optionalStringForKey("fieldKey")
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
lazy var radioButtonModel: RadioButtonModel? = {
|
||||||
|
[unowned self] in
|
||||||
|
if let radioGroupName = radioGroupName,
|
||||||
|
let radioButtonModel = delegateObject?.formValidationProtocol?.formValidatorModel?()?.radioButtonsModelByGroup[radioGroupName] {
|
||||||
|
return radioButtonModel
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
// MARK: - Inits
|
// MARK: - Inits
|
||||||
public init() {
|
public init() {
|
||||||
@ -101,6 +110,5 @@ extension RadioButton {
|
|||||||
let radioButtonModel = RadioButtonModel.setupForRadioButtonGroup(radioButton: self,
|
let radioButtonModel = RadioButtonModel.setupForRadioButtonGroup(radioButton: self,
|
||||||
formValidator: delegateObject?.formValidationProtocol?.formValidatorModel?())
|
formValidator: delegateObject?.formValidationProtocol?.formValidatorModel?())
|
||||||
FormValidator.setupValidation(molecule: radioButtonModel, delegate: delegateObject?.formValidationProtocol)
|
FormValidator.setupValidation(molecule: radioButtonModel, delegate: delegateObject?.formValidationProtocol)
|
||||||
self.radioButtonModel = radioButtonModel
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,6 +49,6 @@ extension RadioButtonModel: FormValidationFormFieldProtocol {
|
|||||||
}
|
}
|
||||||
// The field value key value pair for sending to server
|
// The field value key value pair for sending to server
|
||||||
@objc public func formFieldValue() -> Any? {
|
@objc public func formFieldValue() -> Any? {
|
||||||
return selectedRadioButton != nil ? true : false
|
return selectedRadioButton != nil ? true : false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user