PurchaseForm
public struct PurchaseForm
A series of grouped questions and answers to those questions
-
The groups of questions
Declaration
Swift
public let questionGroups: [QuestionGroup]
-
Adds the supplied answer to the
PurchaseForm
. If the question had already been answered this will replace the answer with the new one.answer: The
Answer
to add
Throws
PurchaseFormError.invalidQuestion
if theQuestion
the suppliedAnswer
answers did not belong to the formDeclaration
Swift
public mutating func addAnswer(_ answer: Answer) throws
-
Validates all answers in the form, using their respective
Question
sValidationRule
Declaration
Swift
public func validate() -> [PurchaseFormError]
Return Value
An
Array<PurchaseFormError>
representing all the validation errors inside the form