Skip to content

Commit 669c138

Browse files
committed
Reorganize package structure and update code formatting
- Renamed module from 'Domain' to 'Domain Standard' for consistency - Updated code formatting and documentation - Updated Package.swift and README - Improved test organization
1 parent 20e5668 commit 669c138

File tree

11 files changed

+42
-63
lines changed

11 files changed

+42
-63
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: 8 additions & 4 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 domain: Self = "Domain"
6+
static let domain: Self = "Domain Standard"
87
}
98

109
extension Target.Dependency {
@@ -18,8 +17,13 @@ extension Target.Dependency {
1817
}
1918

2019
let package = Package(
21-
name: "swift-domain-type",
22-
platforms: [ .macOS(.v13), .iOS(.v16) ],
20+
name: "swift-domain-standard",
21+
platforms: [
22+
.macOS(.v15),
23+
.iOS(.v18),
24+
.tvOS(.v18),
25+
.watchOS(.v11)
26+
],
2327
products: [
2428
.library(name: .domain, targets: [.domain])
2529
],

README.md

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

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

66
Type-safe domain name handling for Swift with multi-RFC standard support.
@@ -21,7 +21,7 @@ Type-safe domain name handling for Swift with multi-RFC standard support.
2121

2222
## Overview
2323

24-
`swift-domain-type` provides a unified `Domain` type that supports multiple RFC standards for domain names:
24+
`swift-domain-standard` provides a unified `Domain` type that supports multiple RFC standards for domain names:
2525

2626
- **RFC 1035**: DNS domain names (strict DNS format)
2727
- **RFC 1123**: Internet host names (allows leading digits)
@@ -44,7 +44,7 @@ Add to your `Package.swift`:
4444

4545
```swift
4646
dependencies: [
47-
.package(url: "https://github.com/coenttb/swift-domain-type", from: "0.1.0")
47+
.package(url: "https://github.com/coenttb/swift-domain-standard", from: "0.1.0")
4848
]
4949
```
5050

@@ -53,7 +53,7 @@ dependencies: [
5353
### Basic Domain Creation
5454

5555
```swift
56-
import Domain
56+
import Domain_Standard
5757

5858
// Create a domain from a string
5959
let domain = try Domain("example.com")
@@ -235,7 +235,7 @@ do {
235235

236236
### Used By
237237

238-
- [swift-emailaddress-type](https://github.com/coenttb/swift-emailaddress-type): A Swift package with a type-safe EmailAddress model.
238+
- [swift-emailaddress-standard](https://github.com/coenttb/swift-emailaddress-standard): A Swift package with a type-safe EmailAddress model.
239239
- [swift-types-foundation](https://github.com/coenttb/swift-types-foundation): A Swift package bundling essential type-safe packages for domain modeling.
240240
- [swift-web-foundation](https://github.com/coenttb/swift-web-foundation): A Swift package with tools to simplify web development.
241241

Sources/Domain/Domain+RFC1035.swift renamed to Sources/Domain Standard/Domain+RFC1035.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_1035
32

43
extension Domain {

Sources/Domain/Domain+RFC1123.swift renamed to Sources/Domain Standard/Domain+RFC1123.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_1123
32

43
extension Domain {

Sources/Domain/Domain.swift renamed to Sources/Domain Standard/Domain.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
//
55
// Created by Coen ten Thije Boonkkamp on 28/12/2024.
66
//
7-
import Foundation
87
import RFC_1035
98
import RFC_1123
109
import RFC_5321
@@ -78,12 +77,12 @@ extension Domain {
7877

7978
/// The top-level domain if available (only for RFC1035/1123 domains)
8079
public var tld: String? {
81-
rfc1035?.tld?.stringValue ?? rfc1123?.tld?.stringValue
80+
rfc1035?.tld?.value ?? rfc1123?.tld?.value
8281
}
8382

8483
/// The second-level domain if available (only for RFC1035/1123 domains)
8584
public var sld: String? {
86-
rfc1035?.sld?.stringValue ?? rfc1123?.sld?.stringValue
85+
rfc1035?.sld?.value ?? rfc1123?.sld?.value
8786
}
8887

8988
/// Returns true if this is a standard domain (not an IP address)
@@ -138,7 +137,7 @@ extension Domain {
138137

139138
// MARK: - Errors
140139
extension Domain {
141-
public enum DomainError: Error, Equatable, LocalizedError {
140+
public enum DomainError: Error, Equatable {
142141
case cannotCreateSubdomain
143142
case conversionFailure
144143
case invalidFormat(description: String)

Tests/Domain Tests/Domain Tests.swift renamed to Tests/Domain Standard Tests/Domain Tests.swift

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

8-
import Foundation
98
import Testing
109

11-
@testable import Domain
10+
@testable import Domain_Standard
1211

1312
@Suite("Domain Tests")
1413
struct DomainTests {

Tests/Domain Tests/RFC 1035 Tests.swift renamed to Tests/Domain Standard Tests/RFC 1035 Tests.swift

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

8-
import Foundation
98
import RFC_1035
109
import Testing
1110

12-
@testable import Domain
11+
@testable import Domain_Standard
1312

1413
@Suite("RFC 1035 Domain Tests")
1514
struct RFC1035Tests {

Tests/Domain Tests/RFC 1123 Tests.swift renamed to Tests/Domain Standard Tests/RFC 1123 Tests.swift

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

8-
import Foundation
98
import RFC_1123
109
import Testing
1110

12-
@testable import Domain
11+
@testable import Domain_Standard
1312

1413
@Suite("RFC 1123 Host Tests")
1514
struct RFC1123Tests {

Tests/Domain Tests/RFC 5321 Tests.swift renamed to Tests/Domain Standard Tests/RFC 5321 Tests.swift

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

8-
import Foundation
98
import RFC_5321
109
import Testing
1110

12-
@testable import Domain
11+
@testable import Domain_Standard
1312

1413
@Suite("RFC 5321 Domain Tests")
1514
struct RFC5321Tests {

0 commit comments

Comments
 (0)