Skip to content

Commit 42bb981

Browse files
committed
docs: update README to reflect trait-based URLRouting integration
1 parent 595262f commit 42bb981

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

README.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,23 @@ encoder3.arrayEncodingStrategy = .bracketsWithIndices
8787

8888
### URLRouting Integration
8989

90+
Enable URLRouting support using Swift Package Manager traits:
91+
9092
```swift
91-
import URLFormCodingURLRouting
92-
import URLRouting
93+
// In your Package.swift
94+
dependencies: [
95+
.package(
96+
url: "https://github.com/coenttb/swift-url-form-coding",
97+
from: "0.1.0",
98+
traits: ["URLRouting"] // Enable URLRouting trait
99+
)
100+
]
101+
```
102+
103+
Then use with URLRouting:
104+
105+
```swift
106+
import URLFormCoding // URLRouting is conditionally exported when trait is enabled
93107

94108
struct ContactForm: Codable {
95109
let name: String
@@ -104,10 +118,17 @@ let contactRoute = Route {
104118
}
105119
```
106120

107-
## Modules
121+
## URLRouting Trait
108122

109-
- **URLFormCoding**: Core encoding/decoding functionality
110-
- **URLFormCodingURLRouting**: Integration with PointFree's [swift-url-routing](https://github.com/pointfreeco/swift-url-routing)
123+
The `URLRouting` trait provides integration with PointFree's [swift-url-routing](https://github.com/pointfreeco/swift-url-routing). When enabled, it:
124+
- Makes `Form.Conversion<T>` conform to `URLRouting.Conversion`
125+
- Provides `.form(_:)` convenience method on `Conversion`
126+
- Re-exports URLRouting for convenient access
127+
128+
To run tests with URLRouting support:
129+
```bash
130+
swift test --traits URLRouting
131+
```
111132

112133
## Dependencies
113134

0 commit comments

Comments
 (0)