You are almost there. Having a warning message buffer is the right idea. But instead of immediately displaying all warnings, you should move the showAlert() call to the showAlert() handler. Therefore, if one warning is rejected, the following will be shown.
Something like that:
var errors : [NSError]! override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated) let error1 = NSError(domain: "Test1", code: 1, userInfo: [NSLocalizedFailureReasonErrorKey : "Test1 reason."]) let error2 = NSError(domain: "Test2", code: 2, userInfo: [NSLocalizedFailureReasonErrorKey : "Test2 reason."]) let error3 = NSError(domain: "Test3", code: 2, userInfo: [NSLocalizedFailureReasonErrorKey : "Test3 reason."]) errors = [error1, error2, error3] showError()
Tip: Firing a few warnings is very annoying. Perhaps you can create a special full-screen viewController that displays all error messages in a UITableView or something like that. This, of course, depends on the number of warning messages that a regular user will see. If it will be regularly more than three, I would use a modal UIViewController, which displays all messages at a glance.
source share