A lightweight, reusable SwiftUI component designed to display e-mail messages.
- Implements the header section with a collection type lacking lookup, to preserve field order and any duplicated field names.
- Gracefully handles e-mail messages that may lack a body. (This is distinct from an empty body.)
- Leverages standard data types, to work with many clients using minimal data massaging.
You can add EmailReadingView to your project using the Swift Package Manager.
- Open your project in Xcode.
- Navigate to File > Add Package Dependencies...
- Enter the repository URL:
https://github.com/CTMacUser/EmailReadingView.git - Follow the prompts to add the package to your target.
Add the following dependency to your dependencies array in Package.swift:
.package(url: "https://github.com/CTMacUser/EmailReadingView.git", from: "0.1.0")And add it to your target's dependencies array:
.target(
name: "YourTarget",
dependencies: [
.product(name: "EmailReadingView", package: "EmailReadingView"),
]),Initialize the view with a list of header fields and an optional body string:
import SwiftUI
import EmailReadingView
struct MyEmailView: View {
let headers: KeyValuePairs<String, String> = [
"From": "[email protected]",
"Subject": "Hello, World!"
]
let content = "This is the content of the e-mail."
var body: some View {
EmailReadingView(InternetMessageDTO(header: headers, body: content))
}
}This project is licensed under LGPL 2.1, with an option to use a later version. See the LICENSE file for details.