You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,7 @@ The default strategy preserves `Optional.none`:
66
66
67
67
```swift
68
68
let encoder =KeyValueEncoder()
69
-
encoder.strategy= .default
69
+
encoder.nilEncodingStrategy= .default
70
70
71
71
// [1, 2, nil, 3]
72
72
let any =try encoder.encode([1, 2, Int?.none, 3])
@@ -75,7 +75,7 @@ let any = try encoder.encode([1, 2, Int?.none, 3])
75
75
Compatibility with [`PropertyListEncoder`](https://developer.apple.com/documentation/foundation/propertylistencoder) is preserved using a placeholder string:
76
76
77
77
```swift
78
-
encoder.strategy= .stringNull
78
+
encoder.nilEncodingStrategy= .stringNull
79
79
80
80
// [1, 2, "$null", 3]
81
81
let any =try encoder.encode([1, 2, Int?.none, 3])
@@ -84,7 +84,7 @@ let any = try encoder.encode([1, 2, Int?.none, 3])
84
84
Compatibility with [`JSONSerialization`](https://developer.apple.com/documentation/foundation/jsonserialization) is preserved using [`NSNull`](https://developer.apple.com/documentation/foundation/nsnull):
85
85
86
86
```swift
87
-
encoder.strategy= .nsNull
87
+
encoder.nilEncodingStrategy= .nsNull
88
88
89
89
// [1, 2, NSNull(), 3]
90
90
let any =try encoder.encode([1, 2, Int?.none, 3])
@@ -93,7 +93,7 @@ let any = try encoder.encode([1, 2, Int?.none, 3])
0 commit comments