Skip to content

Commit 44140bf

Browse files
Strict Concurrency additions and Documentation updates (#55)
- Adding strict-concurrency check and fixing related issues - Adding concurrency-safe ISO8601 date formatting - Fixing issues where Unit Tests have different results on different versions of swift - Additional test runs for older version of iOS - Documentation Updates
2 parents e46a181 + b3f6f39 commit 44140bf

File tree

18 files changed

+1150
-801
lines changed

18 files changed

+1150
-801
lines changed

.github/workflows/ios-tests.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,45 @@ jobs:
3737
device_name: ${{ 'iPhone 15 Pro' }}
3838
run: |
3939
xcodebuild test -scheme "$scheme" -destination "platform=$platform,OS=$OS,name=$device_name"
40+
41+
ios-16-test:
42+
name: iOS 16 tests
43+
runs-on: macos-14
44+
steps:
45+
- uses: actions/checkout@v4
46+
- name: iOS 16
47+
env:
48+
scheme: ${{ 'CodableWrappers' }}
49+
platform: ${{ 'iOS Simulator' }}
50+
OS: ${{ '16.7.10' }}
51+
device_name: ${{ 'iPhone 14 Pro' }}
52+
run: |
53+
xcodebuild test -scheme "$scheme" -destination "platform=$platform,OS=$OS,name=$device_name"
54+
55+
ios-15-test:
56+
name: iOS 15 tests
57+
runs-on: macos-13
58+
steps:
59+
- uses: actions/checkout@v4
60+
- name: iOS 15
61+
env:
62+
scheme: ${{ 'CodableWrappers' }}
63+
platform: ${{ 'iOS Simulator' }}
64+
OS: ${{ '15.8.3' }}
65+
device_name: ${{ 'iPhone 13 Pro' }}
66+
run: |
67+
xcodebuild test -scheme "$scheme" -destination "platform=$platform,OS=$OS,name=$device_name"
68+
ios-14-test:
69+
name: iOS 14 tests
70+
runs-on: macos-13
71+
steps:
72+
- uses: actions/checkout@v4
73+
- name: iOS 14
74+
env:
75+
scheme: ${{ 'CodableWrappers' }}
76+
platform: ${{ 'iOS Simulator' }}
77+
OS: ${{ '14.8.1' }}
78+
device_name: ${{ 'iPhone 12 Pro' }}
79+
run: |
80+
xcodebuild test -scheme "$scheme" -destination "platform=$platform,OS=$OS,name=$device_name"
4081

CodingKeyMacrosDocumentation.md

Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
# CodingKey Macros Documentation
2+
3+
## @CustomCodable
4+
5+
Prerequisite for customizing CodingKeys
6+
7+
```swift
8+
@Codable
9+
struct MyType: Codable {
10+
}
11+
```
12+
13+
## @CustomCodingKey\(String)
14+
15+
Use a custom String value for a Property's CodingKey
16+
17+
```swift
18+
@CustomCodable
19+
struct YourType: Codable {
20+
@CodingKey("your-Custom_naming")
21+
let firstProperty: String // Coding key will be "your-Custom_naming"
22+
}
23+
```
24+
25+
## CodingKeyPrefix\(String)
26+
27+
Set a property's CodingKey with a custom value
28+
29+
```swift
30+
@CustomCodable
31+
struct YourType: Codable {
32+
@CodingKeyPrefix("beta-")
33+
let firstProperty: String // CodingKey will be "beta-firstProperty"
34+
}
35+
```
36+
37+
```swift
38+
@CustomCodable @CodingKeyPrefix("beta-")
39+
struct YourType: Codable {
40+
let firstProperty: String // CodingKey will be "beta-firstProperty"
41+
}
42+
```
43+
44+
## CodingKeySuffix\(String)
45+
46+
/// Add a Suffix a property's CodingKey or Type's CodingKeys with a custom value
47+
48+
```swift
49+
@CustomCodable
50+
struct YourType: Codable {
51+
@CodingKeySuffix("-beta")
52+
let firstProperty: String // CodingKey will be "firstProperty-beta"
53+
}
54+
```
55+
56+
```swift
57+
@CustomCodable @CodingKeySuffix("-beta")
58+
struct YourType: Codable {
59+
let firstProperty: String // CodingKey will be "firstProperty-beta"
60+
}
61+
```
62+
63+
## CamelCase
64+
65+
/// Make the CodingKey for a property or Type `camelCase`
66+
67+
```swift
68+
@CustomCodable
69+
struct YourType: Codable {
70+
@CamelCase
71+
let first-property: String // CodingKey will be "firstProperty"
72+
}
73+
```
74+
75+
```swift
76+
@CustomCodable @CamelCase
77+
struct YourType: Codable {
78+
let first-property: String // CodingKey will be "firstProperty"
79+
}
80+
```
81+
82+
## @FlatCase
83+
84+
Make the CodingKey for a property or Type `flatcase`
85+
86+
```swift
87+
@CustomCodable
88+
struct YourType: Codable {
89+
@FlatCase
90+
let firstProperty: String // CodingKey will be "firstproperty"
91+
}
92+
```
93+
94+
```swift
95+
@CustomCodable @FlatCase
96+
struct YourType: Codable {
97+
let firstProperty: String // CodingKey will be "firstproperty"
98+
}
99+
```
100+
101+
## @PascalCase
102+
103+
Make the CodingKey for a property or Type `PascalCase`
104+
105+
```swift
106+
@CustomCodable
107+
struct YourType: Codable {
108+
@PascalCase
109+
let firstProperty: String // CodingKey will be "FirstProperty"
110+
}
111+
```
112+
113+
```swift
114+
@CustomCodable @PascalCase
115+
struct YourType: Codable {
116+
let firstProperty: String // CodingKey will be "FirstProperty"
117+
}
118+
```
119+
120+
## @UpperCase
121+
122+
Make the CodingKey for a property or Type `UPPERCASE`
123+
124+
```swift
125+
@CustomCodable
126+
struct YourType: Codable {
127+
@UpperCase
128+
let firstProperty: String // CodingKey will be "FIRSTPROPERTY"
129+
}
130+
```
131+
132+
```swift
133+
@CustomCodable @UpperCase
134+
struct YourType: Codable {
135+
let firstProperty: String // CodingKey will be "FIRSTPROPERTY"
136+
}
137+
```
138+
139+
## @SnakeCase
140+
141+
Make the CodingKey for a property or Type `snake_case`
142+
143+
```swift
144+
@CustomCodable
145+
struct YourType: Codable {
146+
@SnakeCase
147+
let firstProperty: String // CodingKey will be "first_property"
148+
}
149+
```
150+
151+
```swift
152+
@CustomCodable @SnakeCase
153+
struct YourType: Codable {
154+
let firstProperty: String // CodingKey will be "first_property"
155+
}
156+
```
157+
158+
## @CamelSnakeCase
159+
160+
Make the CodingKey for a property or Type `camel_Snake_Case`
161+
162+
```swift
163+
@CustomCodable
164+
struct YourType: Codable {
165+
@CamelSnakeCase
166+
let firstProperty: String // CodingKey will be "first_Property"
167+
}
168+
```
169+
170+
```swift
171+
@CustomCodable @CamelSnakeCase
172+
struct YourType: Codable {
173+
let firstProperty: String // CodingKey will be "first_Property"
174+
}
175+
```
176+
177+
## @PascalSnakeCase
178+
179+
Make the CodingKey for a property or Type `Pascal_Snake_Case`
180+
181+
```swift
182+
@CustomCodable
183+
struct YourType: Codable {
184+
@PascalSnakeCase
185+
let firstProperty: String // CodingKey will be "First_Property"
186+
}
187+
```
188+
189+
```swift
190+
@CustomCodable @PascalSnakeCase
191+
struct YourType: Codable {
192+
let firstProperty: String // CodingKey will be "First_Property"
193+
}
194+
```
195+
196+
## @ScreamingSnakeCase
197+
198+
Make the CodingKey for a property or Type `SCREAMING_SNAKE_CASE`
199+
200+
```swift
201+
@CustomCodable
202+
struct YourType: Codable {
203+
@ScreamingSnakeCase
204+
let firstProperty: String // CodingKey will be "FIRST_PROPERTY"
205+
}
206+
```
207+
208+
```swift
209+
@CustomCodable @ScreamingSnakeCase
210+
struct YourType: Codable {
211+
let firstProperty: String // CodingKey will be "FIRST_PROPERTY"
212+
}
213+
```
214+
215+
## @KebabCase
216+
217+
Make the CodingKey for a property or Type `kebab-case`
218+
219+
```swift
220+
@CustomCodable
221+
struct YourType: Codable {
222+
@KebabCase
223+
let firstProperty: String // CodingKey will be "first-property"
224+
}
225+
```
226+
227+
```swift
228+
@CustomCodable @KebabCase
229+
struct YourType: Codable {
230+
let firstProperty: String // CodingKey will be "first-property"
231+
}
232+
```
233+
234+
## @CamelKebabCase
235+
236+
Make the CodingKey for a property or Type `camel-Kebab-Case`
237+
238+
```swift
239+
@CustomCodable
240+
struct YourType: Codable {
241+
@CamelKebabCase
242+
let firstProperty: String // CodingKey will be "first-Property"
243+
}
244+
```
245+
246+
```swift
247+
@CustomCodable @CamelKebabCase
248+
struct YourType: Codable {
249+
let firstProperty: String // CodingKey will be "first-Property"
250+
}
251+
```
252+
253+
## @PascalKebabCase
254+
255+
Make the CodingKey for a property or Type `Pascal-Kebab-Case`
256+
257+
```swift
258+
@CustomCodable
259+
struct YourType: Codable {
260+
@PascalKebabCase
261+
let firstProperty: String // CodingKey will be "First-Property"
262+
}
263+
```
264+
265+
```swift
266+
@CustomCodable @PascalKebabCase
267+
struct YourType: Codable {
268+
let firstProperty: String // CodingKey will be "First-Property"
269+
}
270+
```
271+
272+
## @ScreamingKebabCase
273+
274+
Make the CodingKey for a property or Type `SCREAMING-KEBAB-CASE`
275+
276+
```swift
277+
@CustomCodable
278+
struct YourType: Codable {
279+
@ScreamingKebabCase
280+
let firstProperty: String // CodingKey will be "FIRST-PROPERTY"
281+
}
282+
```
283+
284+
```swift
285+
@CustomCodable @ScreamingKebabCase
286+
struct YourType: Codable {
287+
let firstProperty: String // CodingKey will be "FIRST-PROPERTY"
288+
}
289+
```
290+
</details>

DOCKER.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

Dockerfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

Package.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ let package = Package(
3737
targets: [
3838
.target(
3939
name: "CodableWrappers",
40-
dependencies: ["CodableWrapperMacros"]),
40+
dependencies: ["CodableWrapperMacros"],
41+
swiftSettings: [
42+
.enableExperimentalFeature("StrictConcurrency")
43+
]),
4144
// plugins: [.plugin(name: "SwiftLintPlugin", package: "SwiftLint")]),
4245

4346
.testTarget(
@@ -49,6 +52,9 @@ let package = Package(
4952
dependencies: [
5053
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
5154
.product(name: "SwiftCompilerPlugin", package: "swift-syntax")
55+
],
56+
swiftSettings: [
57+
.enableExperimentalFeature("StrictConcurrency")
5258
]
5359
),
5460

@@ -79,5 +85,6 @@ let package = Package(
7985
.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"),
8086
]
8187
),
82-
]
88+
],
89+
swiftLanguageVersions: [.version("6"), .v5]
8390
)

0 commit comments

Comments
 (0)