Skip to content

Commit 6cf899b

Browse files
committed
Update code formatting and implementation
1 parent ae32be1 commit 6cf899b

File tree

5 files changed

+40
-55
lines changed

5 files changed

+40
-55
lines changed

.gitignore

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
1-
# Swift Package Manager
2-
.build/
3-
.swiftpm/
4-
Package.resolved
1+
*~
52

6-
# Xcode
7-
*.xcodeproj/
8-
*.xcworkspace/
9-
xcuserdata/
3+
Package.resolved
104
DerivedData/
11-
*.hmap
12-
*.ipa
13-
*.dSYM.zip
14-
*.dSYM
15-
16-
# macOS
17-
.DS_Store
18-
19-
# AI tools
20-
CLAUDE.md
21-
.claude
22-
.cursor/
23-
.aider*
5+
Thumbs.db
246

25-
# IDE
26-
.vscode/
27-
.idea/
7+
# Dot files/directories (opt-in only)
8+
/.*
9+
!/.github
10+
!/.gitignore
11+
!/.spi.yml
12+
!/.swift-format
13+
!/.swiftformat
14+
!/.swiftlint.yml
2815

29-
# Temporary files
30-
*.tmp
31-
*.swp
32-
*~
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: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,38 @@
11
// swift-tools-version:6.0
22

3-
import Foundation
43
import PackageDescription
54

6-
extension String {
7-
static let rfc5321: Self = "RFC_5321"
8-
}
9-
10-
extension Target.Dependency {
11-
static var rfc5321: Self { .target(name: .rfc5321) }
12-
static var rfc1123: Self { .product(name: "RFC_1123", package: "swift-rfc-1123") }
13-
}
14-
155
let package = Package(
166
name: "swift-rfc-5321",
177
platforms: [
18-
.macOS(.v13),
19-
.iOS(.v16)
8+
.macOS(.v15),
9+
.iOS(.v18),
10+
.tvOS(.v18),
11+
.watchOS(.v11)
2012
],
2113
products: [
22-
.library(name: .rfc5321, targets: [.rfc5321]),
14+
.library(name: "RFC_5321", targets: ["RFC_5321"]),
2315
],
2416
dependencies: [
25-
.package(url: "https://github.com/swift-standards/swift-rfc-1123.git", from: "0.0.1"),
17+
.package(url: "https://github.com/swift-standards/swift-incits-4-1986.git", from: "0.0.1"),
18+
.package(url: "https://github.com/swift-standards/swift-rfc-1123.git", from: "0.0.1")
2619
],
2720
targets: [
2821
.target(
29-
name: .rfc5321,
22+
name: "RFC_5321",
3023
dependencies: [
31-
.rfc1123
24+
.product(name: "RFC_1123", package: "swift-rfc-1123"),
25+
.product(name: "INCITS 4 1986", package: "swift-incits-4-1986")
3226
]
3327
),
3428
.testTarget(
35-
name: .rfc5321.tests,
29+
name: "RFC_5321".tests,
3630
dependencies: [
37-
.rfc5321
31+
"RFC_5321"
3832
]
3933
),
4034
],
4135
swiftLanguageModes: [.v6]
4236
)
4337

44-
extension String { var tests: Self { self + " Tests" } }
38+
extension String { var tests: Self { self + " Tests" } }

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ print(email.domain.name) // "example.com"
5757
// Parse with display name
5858
let namedEmail = try EmailAddress("John Doe <[email protected]>")
5959
print(namedEmail.displayName) // "John Doe"
60-
print(namedEmail.addressValue) // "[email protected]"
60+
print(namedEmail.address) // "[email protected]"
6161

6262
// Parse with quoted display name
6363
let quotedEmail = try EmailAddress("\"Doe, John\" <[email protected]>")
@@ -77,7 +77,7 @@ let email = EmailAddress(
7777
)
7878

7979
print(email.stringValue) // "Support Team <[email protected]>"
80-
print(email.addressValue) // "[email protected]"
80+
print(email.address) // "[email protected]"
8181
```
8282

8383
### Validation
@@ -118,7 +118,7 @@ public struct EmailAddress: Hashable, Sendable {
118118
public init(_ string: String) throws
119119

120120
public var stringValue: String // Full format with display name
121-
public var addressValue: String // Just the email address part
121+
public var address: String // Just the email address part
122122
}
123123
```
124124

@@ -177,4 +177,4 @@ This library is released under the Apache License 2.0. See [LICENSE](LICENSE) fo
177177

178178
## Contributing
179179

180-
Contributions are welcome! Please feel free to submit a Pull Request.
180+
Contributions are welcome! Please feel free to submit a Pull Request.

Tests/RFC_5321 Tests/RFC 5321 Tests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Created by Coen ten Thije Boonkkamp on 28/12/2024.
66
//
77

8-
import Foundation
98
import RFC_5321
9+
import Foundation
1010
import Testing
1111

1212
@Suite("RFC 5321 Domain Tests")

Tests/RFC_5321 Tests/ReadmeVerificationTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct ReadmeVerificationTests {
2222
func parseWithDisplayName() throws {
2323
let namedEmail = try EmailAddress("John Doe <[email protected]>")
2424
#expect(namedEmail.displayName == "John Doe")
25-
#expect(namedEmail.addressValue == "[email protected]")
25+
#expect(namedEmail.address == "[email protected]")
2626
}
2727

2828
@Test("README Line 62-64: Parse with quoted display name")
@@ -41,8 +41,8 @@ struct ReadmeVerificationTests {
4141
domain: domain
4242
)
4343

44-
#expect(email.stringValue == "Support Team <[email protected]>")
45-
#expect(email.addressValue == "[email protected]")
44+
#expect(email.description == "Support Team <[email protected]>")
45+
#expect(email.address == "[email protected]")
4646
}
4747

4848
@Test("README Line 86-89: Valid addresses")

0 commit comments

Comments
 (0)