-
Notifications
You must be signed in to change notification settings - Fork 8
3. Dealing With Email Composing Results
Gabriel Theodoropoulos edited this page Jul 22, 2021
·
1 revision
To handle the email composing results, provide a closure as argument to the result
optional parameter. The closure's argument is a Result<EmailComposerResult, Error>
value. See the discussion about the EmailComposerResult
symbol for more information about the possible values on success.
Here is an example of determining the result:
Button("Send email") {
showEmailComposer = true
}
.emailComposer(isPresented: $showEmailComposer) { result in
switch result {
case .success(let value):
if value == .deviceCannotSendEmails {
print("Device cannot send emails.")
}
print(value.description)
case .failure(let error):
print(error.localizedDescription)
}
}