Making your life easier!
Entering an email address is trivial, so is checking whether a string is a valid email address. But allowing multiple email addresses to be entered in the same field, while validating them, and making the whole thing user-friendly, is a little less so.
That's why I have created EmailField!
Now you can directly obtain the same behavior as your favorite mail manager without any effort!
| Fields and chips | Invalid and remove chips |
|---|---|
![]() |
![]() |
- SwiftUI (iOS >= 15, macOS >= 12)
Nowaday we only support Swift Package Manager. You can use build-in UI tool for XCode with this search words: EmailField or you can add it directly with this following command :
.package(url: "https://github.com/Kelvas09/EmailField.git", from: "1.0.0")First of all you have to import the library EmailField:
import EmailFieldThen you just have to add an EmailField on your screen:
...
EmailField(emails: $to, placeholder: "To")
EmailField(emails: $cc, placeholder: "Cc")
EmailField(emails: $bcc, placeholder: "Bcc")
...Here is a complete example:
import SwiftUI
import EmailField
struct ContentView: View {
@State
private var to: [Email] = []
@State
private var cc: [Email] = []
@State
private var bcc: [Email] = []
var body: some View {
VStack {
EmailField(emails: $to, placeholder: "To")
EmailField(emails: $cc, placeholder: "Cc")
EmailField(emails: $bcc, placeholder: "Bcc")
Spacer()
Button {
// Nothing to do here
} label: {
Text("Send")
}
.buttonStyle(.borderedProminent)
}
.padding()
}
}You can access to sample project on folder EmailFieldSample

