Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/swiftui-plus/mailview
A SwiftUI view that enables you to properly present a MFMailComposeViewController. (iOS)
https://github.com/swiftui-plus/mailview
ios mail mailcomposer swift swiftui
Last synced: 3 months ago
JSON representation
A SwiftUI view that enables you to properly present a MFMailComposeViewController. (iOS)
- Host: GitHub
- URL: https://github.com/swiftui-plus/mailview
- Owner: SwiftUI-Plus
- License: mit
- Created: 2021-08-28T17:38:59.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-11T23:02:28.000Z (10 months ago)
- Last Synced: 2024-04-12T04:23:42.281Z (10 months ago)
- Topics: ios, mail, mailcomposer, swift, swiftui
- Language: Swift
- Homepage: https://benkau.com/packages.json
- Size: 18.6 KB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
![ios](https://img.shields.io/badge/iOS-14-green)
![ios](https://img.shields.io/badge/macOS-11-green)# MailView
A SwiftUI view that enables you to properly present the default email client composer for both iOS and macOS.
## Features
- Modern SwiftUI implementation.
- Structured approach with custom types for Mail, Message, Attachment.
- Full concurrency support for attachments with low-memory consumption.
- Support for `mailto` strings, so you can instantiate `Mail` using mailto value.
- Familiar API (similar to ShareLink, PasteButton, etc)## Example
```swift
@State private var mail: Mail = .init(
to: "[email protected]",
subject: "Hello, world!",
message: "Lorem ipsum...""
)var body: some View {
MailButton(mail: mail)
}
```__Custom label__
```swift
var body: some View {
MailButton(mail: mail) {
Text("Custom label")
}
}
```__Mail is `ExpressibleByStringLiteral`__
```swift
// Create a `Mail` type with its `to` property set.
mail = "[email protected]"// You can even pass an entire `mailto:` string:
mail = "mailto:[email protected]&subject=Foo&body=Bar"
```## Installation
The code is packaged as a framework. You can install manually (by copying the files in the `Sources` directory) or using Swift Package Manager (**preferred**)
To install using Swift Package Manager, add this to the `dependencies` section of your `Package.swift` file:
`.package(url: "https://github.com/SwiftUI-Plus/MailView.git", .upToNextMinor(from: "2.0.0"))`
> Note: The package requires iOS v13+
## Other Packages
If you want easy access to this and more packages, add the following collection to your Xcode 13+ configuration:
`https://benkau.com/packages.json`