Skip to content

Commit 09a8b01

Browse files
committed
Update UIApplicationExtension.swift
1 parent ded7999 commit 09a8b01

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/SwiftBoost/UIKit/Extensions/UIApplicationExtension.swift

+6
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,11 @@ public extension UIApplication {
3636
return nil
3737
}
3838

39+
func openMailTo(_ email: String, subject: String, body: String = .empty) {
40+
let coded = "mailto:\(email)?subject=\(subject)&body=\(body)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
41+
if let coded, let emailURL = URL(string: coded), canOpenURL(emailURL) {
42+
open(emailURL)
43+
}
44+
}
3945
}
4046
#endif

0 commit comments

Comments
 (0)