You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 inswitch result {case.success(let value):if value ==.deviceCannotSendEmails {print("Device cannot send emails.")}print(value.description)case.failure(let error):print(error.localizedDescription)}}
The EmailComposerResult/deviceCannotSendEmails value is treated separately above in order to highlight that the case of a device unable to send emails is among all possible cases of a successful result. The other cases are: sent, saved, cancelled, and failed. For each one there is a textual description provided.