Skip to content

Commit

Permalink
Merge pull request ResearchKit#14 from Erin-Mounts/fix_validate_func
Browse files Browse the repository at this point in the history
Fix validate func
  • Loading branch information
Erin-Mounts committed May 3, 2018
2 parents 7a6e12d + 66b12d4 commit f9a523c
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -787,11 +787,18 @@ open class RSDTableStepViewController: RSDStepViewController, UITableViewDataSou
/// Validate the text field value and save the answer if valid.
@discardableResult
public func validateAndSave(textField: UITextField? = nil) -> Bool {
guard let customTextField = (textField ?? activeTextField) as? RSDStepTextField,
// If there isn't an active text field, then return true.
guard let textField = (textField ?? activeTextField)
else {
return true
}

// If the text field is not an RSDStepTextField then return false.
guard let customTextField = textField as? RSDStepTextField,
let indexPath = customTextField.indexPath else {
return false
}

let answer: Any? = {
if let picker = customTextField.inputView as? RSDPickerViewProtocol {
return picker.answer
Expand Down

0 comments on commit f9a523c

Please sign in to comment.