title: Send email using Default email provider - SwiftUI
body: <p>With the new option of setting the default mail app on settings, I'm wondering if there is a simpler solution to sending emails. Right now I'm using a manual solution adding 3rd party apps manually, like this:</p>
  <pre><code>...
  if MFMailComposeViewController.canSendMail() {
      self.settingsViewModel.showingFeatureEmail.toggle()
  } else if let emailUrl = self.settingsViewModel.createEmailUrl(to: self.generalConstants.email, subject: &quot;Feature request! [\(self.generalConstants.appName)]&quot;, body: &quot;Hello, I have this idea &quot;) {
      UIApplication.shared.open(emailUrl)
  } else {
      self.settingsViewModel.showMailFeatureAlert = true
  }
  ...
  
  func createEmailUrl(to: String, subject: String, body: String) -&gt; URL? {
      let subjectEncoded = subject.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!
      let bodyEncoded = body.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!
  
      let gmailUrl = URL(string: &quot;googlegmail://co?to=\(to)&amp;subject=\(subjectEncoded)&amp;body=\(bodyEncoded)&quot;)
      let outlookUrl = URL(string: &quot;ms-outlook://compose?to=\(to)&amp;subject=\(subjectEncoded)&quot;)
      let yahooMail = URL(string: &quot;ymail://mail/compose?to=\(to)&amp;subject=\(subjectEncoded)&amp;body=\(bodyEncoded)&quot;)
      let sparkUrl = URL(string: &quot;readdle-spark://compose?recipient=\(to)&amp;subject=\(subjectEncoded)&amp;body=\(bodyEncoded)&quot;)
  
      if let gmailUrl = gmailUrl, UIApplication.shared.canOpenURL(gmailUrl) { return gmailUrl }
      else if let outlookUrl = outlookUrl, UIApplication.shared.canOpenURL(outlookUrl) { return outlookUrl }
      else if let yahooMail = yahooMail, UIApplication.shared.canOpenURL(yahooMail){ return yahooMail }
      else if let sparkUrl = sparkUrl, UIApplication.shared.canOpenURL(sparkUrl) { return sparkUrl }
      return nil
  }
  </code></pre>
  <p>Is there a way to simply ask, what is your default mail app, and open it to write the email?</p>
  <p>Using the method above it only checks for apple mail app as default and whatever I have defined for the 3rd parties.</p>