Last active
August 13, 2022 03:21
-
-
Save modestman/ec55a074350cee8d61a066d28912482e to your computer and use it in GitHub Desktop.
Url scheme for compose email with Gmail and Spark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController { | |
@IBAction func gmail(_ sender: Any) { | |
let compose = "googlegmail:///co?subject=Subject&body=some text&to=test@example.com" | |
.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! | |
let url = URL(string: compose)! | |
if UIApplication.shared.canOpenURL(url) { | |
UIApplication.shared.open(url) | |
} | |
} | |
@IBAction func spark(_ sender: Any) { | |
let compose = "readdle-spark://compose?subject=Subject&body=some text&recipient=test@example.com" | |
.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! | |
let url = URL(string: compose)! | |
if UIApplication.shared.canOpenURL(url) { | |
UIApplication.shared.open(url) | |
} | |
} | |
} | |
is there a way to attach a document into the e-mail?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Необходимо добавить запрашиваемые схемы (googlegmail, readdle-spark) в Info.plist по ключу
LSApplicationQueriesSchemes