Skip to content

Commit d152f4c

Browse files
committed
Reorganize package structure and add String extensions
- Renamed module from 'EmailAddress' to 'EmailAddress Standard' for consistency - Added String.swift with String extension utilities - Updated code formatting and documentation - Updated Package.swift and README
1 parent 4333410 commit d152f4c

16 files changed

+129
-144
lines changed

.gitignore

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,23 @@
1-
# Swift
2-
.build/
3-
.swiftpm/
4-
Package.resolved
5-
6-
# Environment files
7-
.env*
8-
9-
# Xcode
10-
*.xcodeproj
11-
*.xcworkspace
12-
*.xcuserdata
13-
DerivedData/
14-
15-
# IDEs
16-
.vscode/
17-
.idea/
18-
*.swp
19-
*.swo
201
*~
212

22-
# Generated by MacOS
23-
.DS_Store
24-
25-
# Generated by Windows
3+
Package.resolved
4+
DerivedData/
265
Thumbs.db
276

28-
# Generated by Linux
29-
*~
30-
31-
# Log files
32-
*.log
33-
34-
# AI
35-
.claude
36-
CLAUDE.MD
37-
38-
# Temporary files
39-
*.tmp
40-
*.temp
7+
# Dot files/directories (opt-in only)
8+
/.*
9+
!/.github
10+
!/.gitignore
11+
!/.spi.yml
12+
!/.swift-format
13+
!/.swiftformat
14+
!/.swiftlint.yml
15+
16+
# Documentation (opt-in for top-level .md files only)
17+
/*.md
18+
!README.md
19+
!LICENSE.md
20+
!CHANGELOG.md
21+
!CONTRIBUTING.md
22+
!CODE_OF_CONDUCT.md
23+
!SECURITY.md

Package.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// swift-tools-version:6.0
22

3-
import Foundation
43
import PackageDescription
54

65
extension String {
7-
static let emailAddress: Self = "EmailAddress"
6+
static let emailAddress: Self = "EmailAddress Standard"
87
}
98

109
extension Target.Dependency {
@@ -16,12 +15,17 @@ extension Target.Dependency {
1615
static var rfc5321: Self { .product(name: "RFC_5321", package: "swift-rfc-5321") }
1716
static var rfc5322: Self { .product(name: "RFC_5322", package: "swift-rfc-5322") }
1817
static var rfc6531: Self { .product(name: "RFC_6531", package: "swift-rfc-6531") }
19-
static var domain: Self { .product(name: "Domain", package: "swift-domain-type") }
18+
static var domain: Self { .product(name: "Domain Standard", package: "swift-domain-standard") }
2019
}
2120

2221
let package = Package(
23-
name: "swift-emailaddress-type",
24-
platforms: [ .macOS(.v13), .iOS(.v16) ],
22+
name: "swift-emailaddress-standard",
23+
platforms: [
24+
.macOS(.v15),
25+
.iOS(.v18),
26+
.tvOS(.v18),
27+
.watchOS(.v11)
28+
],
2529
products: [
2630
.library(name: .emailAddress, targets: [.emailAddress])
2731
],
@@ -30,7 +34,7 @@ let package = Package(
3034
.package(url: "https://github.com/swift-standards/swift-rfc-5321", from: "0.1.0"),
3135
.package(url: "https://github.com/swift-standards/swift-rfc-5322", from: "0.1.0"),
3236
.package(url: "https://github.com/swift-standards/swift-rfc-6531", from: "0.1.0"),
33-
.package(url: "https://github.com/swift-standards/swift-domain-type", from: "0.1.0")
37+
.package(url: "https://github.com/swift-standards/swift-domain-standard", from: "0.1.0")
3438
],
3539
targets: [
3640
.target(

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# swift-emailaddress-type
1+
# swift-emailaddress-standard
22

3-
[![CI](https://github.com/coenttb/swift-emailaddress-type/workflows/CI/badge.svg)](https://github.com/coenttb/swift-emailaddress-type/actions/workflows/ci.yml)
3+
[![CI](https://github.com/coenttb/swift-emailaddress-standard/workflows/CI/badge.svg)](https://github.com/coenttb/swift-emailaddress-standard/actions/workflows/ci.yml)
44
![Development Status](https://img.shields.io/badge/status-active--development-blue.svg)
55

66
Type-safe email address validation and parsing for Swift, supporting multiple RFC standards.
77

88
## Overview
99

10-
`swift-emailaddress-type` provides a robust `EmailAddress` type that supports multiple RFC standards for email address formats:
10+
`swift-emailaddress-standard` provides a robust `EmailAddress` type that supports multiple RFC standards for email address formats:
1111

1212
- **RFC 5321**: SMTP email addresses (ASCII-only, strict format)
1313
- **RFC 5322**: Internet Message Format addresses (ASCII with display names)
@@ -23,15 +23,15 @@ The library automatically selects the most appropriate RFC format based on the i
2323
- **Type Safety**: Compile-time guarantees with Swift 6.0 strict concurrency
2424
- **Validation**: Automatic validation against RFC standards
2525
- **Codable**: Full JSON encoding/decoding support
26-
- **Domain Support**: Integrated with `swift-domain-type` for proper domain handling
26+
- **Domain Support**: Integrated with `swift-domain-standard` for proper domain handling
2727

2828
## Installation
2929

3030
Add to your `Package.swift`:
3131

3232
```swift
3333
dependencies: [
34-
.package(url: "https://github.com/coenttb/swift-emailaddress-type", from: "0.0.1")
34+
.package(url: "https://github.com/coenttb/swift-emailaddress-standard", from: "0.0.1")
3535
]
3636
```
3737

@@ -40,7 +40,7 @@ dependencies: [
4040
### Basic Email Addresses
4141

4242
```swift
43-
import EmailAddress
43+
import EmailAddress_Standard
4444

4545
// Simple email address
4646
let email = try EmailAddress("[email protected]")
@@ -148,11 +148,11 @@ if let rfc5322 = email.rfc5322 {
148148

149149
```swift
150150
// Convert from string
151-
let email = try "[email protected]".asEmailAddress()
151+
let email = try EmailAddress("[email protected]")
152152

153153
// Convert to string
154-
let emailString = email.stringValue
155-
let addressOnly = email.addressValue // Without display name
154+
let emailString = email.value
155+
let addressOnly = email.address // Without display name
156156
```
157157

158158
### Codable Support
@@ -266,7 +266,7 @@ public enum EmailAddressError: Error, Equatable, LocalizedError {
266266

267267
### Dependencies
268268

269-
- [swift-domain-type](https://github.com/coenttb/swift-domain-type): A Swift package with a type-safe Domain model.
269+
- [swift-domain-standard](https://github.com/coenttb/swift-domain-standard): A Swift package with a type-safe Domain model.
270270

271271
### Used By
272272

@@ -291,7 +291,7 @@ Contributions are welcome! Please feel free to submit a Pull Request.
291291

292292
This package is part of the [coenttb](https://github.com/coenttb) suite of Swift server-side packages.
293293

294-
For issues, questions, or contributions, please visit the [GitHub repository](https://github.com/coenttb/swift-emailaddress-type).
294+
For issues, questions, or contributions, please visit the [GitHub repository](https://github.com/coenttb/swift-emailaddress-standard).
295295

296296
- [Subscribe to newsletter](http://coenttb.com/en/newsletter/subscribe)
297297
- [Follow on X](http://x.com/coenttb)

Sources/EmailAddress/EmailAddress+RFC2822.swift renamed to Sources/EmailAddress Standard/EmailAddress+RFC2822.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Foundation
21
import RFC_2822
32
import RFC_5322
43

Sources/EmailAddress/EmailAddress+RFC5321.swift renamed to Sources/EmailAddress Standard/EmailAddress+RFC5321.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Foundation
21
import RFC_5321
32
import RFC_5322
43
import RFC_6531

Sources/EmailAddress/EmailAddress+RFC5322.swift renamed to Sources/EmailAddress Standard/EmailAddress+RFC5322.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Foundation
21
import RFC_5321
32
import RFC_5322
43
import RFC_6531

Sources/EmailAddress/EmailAddress+RFC6531.swift renamed to Sources/EmailAddress Standard/EmailAddress+RFC6531.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Foundation
21
import RFC_5321
32
import RFC_5322
43
import RFC_6531

0 commit comments

Comments
 (0)