@@ -54,10 +54,7 @@ public class Form: UIScrollView {
5454 public var formDelegate : FormDelegate !
5555
5656 /// The current input which has been focused
57- private var currentInput : FormInput !
58-
59- /// The form inputs
60- public var inputs : [ FormInput ] = [ ] {
57+ private var currentInput : FormInput ! {
6158 didSet {
6259 handleInputsReturnKeys ( )
6360 }
@@ -79,7 +76,6 @@ public class Form: UIScrollView {
7976
8077 if let input: FormInput = view as? FormInput {
8178 input. formInputDelegate = self
82- inputs. append ( input)
8379 }
8480 }
8581
@@ -118,6 +114,7 @@ public class Form: UIScrollView {
118114 Handles return keys type for inputs
119115 */
120116 private func handleInputsReturnKeys( ) {
117+ let inputs = getOrderedInputs ( )
121118 for input in inputs {
122119 if let textField: UITextField = input as? UITextField {
123120 if textField == inputs. last as? UITextField {
@@ -225,6 +222,24 @@ public class Form: UIScrollView {
225222
226223 return true
227224 }
225+
226+ /**
227+ Gets the ordered inputs of the form
228+
229+ - Return: the ordered inputs
230+ */
231+ func getOrderedInputs( ) -> [ FormInput ] {
232+ var inputs : [ FormInput ] = [ ]
233+ if let _ = formDelegate {
234+ var inputToAdd : FormInput ? = formDelegate. getFirstInput ( self )
235+ while nil != inputToAdd {
236+ inputs. append ( inputToAdd!)
237+ inputToAdd = formDelegate. getNextInput ( self , currentInput: inputToAdd!)
238+ }
239+ }
240+
241+ return inputs
242+ }
228243}
229244
230245// MARK: Extensions
0 commit comments