Skip to content

Commit 5985794

Browse files
committed
Change compiler directives, in IUO overloads, to target the Swift 4.1 compiler and below
1 parent c31a112 commit 5985794

File tree

5 files changed

+56
-28
lines changed

5 files changed

+56
-28
lines changed

Sources/EnumOperators.swift

+6-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ public func >>> <T: RawRepresentable>(left: T?, right: Map) {
3131
}
3232

3333

34-
#if !swift(>=4.2)
34+
// Code targeting the Swift 4.1 compiler and below.
35+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
3536
/// Implicitly Unwrapped Optional Object of Raw Representable type
3637
public func <- <T: RawRepresentable>(left: inout T!, right: Map) {
3738
left <- (right, EnumTransform())
@@ -60,7 +61,8 @@ public func >>> <T: RawRepresentable>(left: [T]?, right: Map) {
6061
}
6162

6263

63-
#if !swift(>=4.2)
64+
// Code targeting the Swift 4.1 compiler and below.
65+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
6466
/// Array of Raw Representable object
6567
public func <- <T: RawRepresentable>(left: inout [T]!, right: Map) {
6668
left <- (right, EnumTransform())
@@ -89,7 +91,8 @@ public func >>> <T: RawRepresentable>(left: [String: T]?, right: Map) {
8991
}
9092

9193

92-
#if !swift(>=4.2)
94+
// Code targeting the Swift 4.1 compiler and below.
95+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
9396
/// Dictionary of Raw Representable object
9497
public func <- <T: RawRepresentable>(left: inout [String: T]!, right: Map) {
9598
left <- (right, EnumTransform())

Sources/FromJSON.swift

+14-7
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ internal final class FromJSON {
4040
field = object
4141
}
4242

43-
#if !swift(>=4.2)
43+
// Code targeting the Swift 4.1 compiler and below.
44+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
4445
/// Implicitly unwrapped optional basic type
4546
class func optionalBasicType<FieldType>(_ field: inout FieldType!, object: FieldType?) {
4647
field = object
@@ -66,7 +67,8 @@ internal final class FromJSON {
6667
}
6768
}
6869

69-
#if !swift(>=4.2)
70+
// Code targeting the Swift 4.1 compiler and below.
71+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
7072
/// Implicitly unwrapped Optional Mappable Object
7173
class func optionalObject<N: BaseMappable>(_ field: inout N!, map: Map) {
7274
if let f = field , map.toObject && map.currentValue != nil {
@@ -94,7 +96,8 @@ internal final class FromJSON {
9496
}
9597
}
9698

97-
#if !swift(>=4.2)
99+
// Code targeting the Swift 4.1 compiler and below.
100+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
98101
/// Implicitly unwrapped optional mappable object array
99102
class func optionalObjectArray<N: BaseMappable>(_ field: inout Array<N>!, map: Map) {
100103
if let objects: Array<N> = Mapper(context: map.context).mapArray(JSONObject: map.currentValue) {
@@ -117,7 +120,8 @@ internal final class FromJSON {
117120
field = Mapper(context: map.context).mapArrayOfArrays(JSONObject: map.currentValue)
118121
}
119122

120-
#if !swift(>=4.2)
123+
// Code targeting the Swift 4.1 compiler and below.
124+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
121125
/// Implicitly unwrapped optional 2 dimentional mappable object array
122126
class func optionalTwoDimensionalObjectArray<N: BaseMappable>(_ field: inout Array<Array<N>>!, map: Map) {
123127
field = Mapper(context: map.context).mapArrayOfArrays(JSONObject: map.currentValue)
@@ -144,7 +148,8 @@ internal final class FromJSON {
144148
}
145149
}
146150

147-
#if !swift(>=4.2)
151+
// Code targeting the Swift 4.1 compiler and below.
152+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
148153
/// Implicitly unwrapped Dictionary containing Mappable objects
149154
class func optionalObjectDictionary<N: BaseMappable>(_ field: inout Dictionary<String, N>!, map: Map) {
150155
if let f = field , map.toObject && map.currentValue != nil {
@@ -167,7 +172,8 @@ internal final class FromJSON {
167172
field = Mapper<N>(context: map.context).mapDictionaryOfArrays(JSONObject: map.currentValue)
168173
}
169174

170-
#if !swift(>=4.2)
175+
// Code targeting the Swift 4.1 compiler and below.
176+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
171177
/// Implicitly unwrapped Dictionary containing Array of Mappable objects
172178
class func optionalObjectDictionaryOfArrays<N: BaseMappable>(_ field: inout Dictionary<String, [N]>!, map: Map) {
173179
field = Mapper<N>(context: map.context).mapDictionaryOfArrays(JSONObject: map.currentValue)
@@ -186,7 +192,8 @@ internal final class FromJSON {
186192
field = Mapper(context: map.context).mapSet(JSONObject: map.currentValue)
187193
}
188194

189-
#if !swift(>=4.2)
195+
// Code targeting the Swift 4.1 compiler and below.
196+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
190197
/// Implicitly unwrapped optional mappable object array
191198
class func optionalObjectSet<N: BaseMappable>(_ field: inout Set<N>!, map: Map) {
192199
field = Mapper(context: map.context).mapSet(JSONObject: map.currentValue)

Sources/IntegerOperators.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ public func <- <T: SignedInteger>(left: inout T?, right: Map) {
3434
}
3535
}
3636

37-
#if !swift(>=4.2)
37+
// Code targeting the Swift 4.1 compiler and below.
38+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
3839
/// ImplicitlyUnwrappedOptional SignedInteger mapping
3940
public func <- <T: SignedInteger>(left: inout T!, right: Map) {
4041
switch right.mappingType {
@@ -76,7 +77,8 @@ public func <- <T: UnsignedInteger>(left: inout T?, right: Map) {
7677
}
7778
}
7879

79-
#if !swift(>=4.2)
80+
// Code targeting the Swift 4.1 compiler and below.
81+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
8082
/// ImplicitlyUnwrappedOptional UnsignedInteger mapping
8183
public func <- <T: UnsignedInteger>(left: inout T!, right: Map) {
8284
switch right.mappingType {

Sources/Operators.swift

+14-7
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ public func >>> <T>(left: T?, right: Map) {
7676
}
7777

7878

79-
#if !swift(>=4.2)
79+
// Code targeting the Swift 4.1 compiler and below.
80+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
8081
/// Implicitly unwrapped optional object of basic type
8182
public func <- <T>(left: inout T!, right: Map) {
8283
switch right.mappingType {
@@ -126,7 +127,8 @@ public func >>> <T: BaseMappable>(left: T?, right: Map) {
126127
}
127128

128129

129-
#if !swift(>=4.2)
130+
// Code targeting the Swift 4.1 compiler and below.
131+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
130132
/// Implicitly unwrapped optional Mappable objects
131133
public func <- <T: BaseMappable>(left: inout T!, right: Map) {
132134
switch right.mappingType {
@@ -177,7 +179,8 @@ public func >>> <T: BaseMappable>(left: Dictionary<String, T>?, right: Map) {
177179
}
178180

179181

180-
#if !swift(>=4.2)
182+
// Code targeting the Swift 4.1 compiler and below.
183+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
181184
/// Implicitly unwrapped Optional Dictionary of Mappable object <String, T: Mappable>
182185
public func <- <T: BaseMappable>(left: inout Dictionary<String, T>!, right: Map) {
183186
switch right.mappingType {
@@ -225,7 +228,8 @@ public func >>> <T: BaseMappable>(left: Dictionary<String, [T]>?, right: Map) {
225228
}
226229

227230

228-
#if !swift(>=4.2)
231+
// Code targeting the Swift 4.1 compiler and below.
232+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
229233
/// Implicitly unwrapped Optional Dictionary of Mappable object <String, T: Mappable>
230234
public func <- <T: BaseMappable>(left: inout Dictionary<String, [T]>!, right: Map) {
231235
switch right.mappingType {
@@ -275,7 +279,8 @@ public func >>> <T: BaseMappable>(left: Array<T>?, right: Map) {
275279
}
276280

277281

278-
#if !swift(>=4.2)
282+
// Code targeting the Swift 4.1 compiler and below.
283+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
279284
/// Implicitly unwrapped Optional array of Mappable objects
280285
public func <- <T: BaseMappable>(left: inout Array<T>!, right: Map) {
281286
switch right.mappingType {
@@ -326,7 +331,8 @@ public func >>> <T: BaseMappable>(left: Array<Array<T>>?, right: Map) {
326331
}
327332

328333

329-
#if !swift(>=4.2)
334+
// Code targeting the Swift 4.1 compiler and below.
335+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
330336
/// Implicitly unwrapped Optional array of Mappable objects
331337
public func <- <T: BaseMappable>(left: inout Array<Array<T>>!, right: Map) {
332338
switch right.mappingType {
@@ -377,7 +383,8 @@ public func >>> <T: BaseMappable>(left: Set<T>?, right: Map) {
377383
}
378384

379385

380-
#if !swift(>=4.2)
386+
// Code targeting the Swift 4.1 compiler and below.
387+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
381388
/// Implicitly unwrapped Optional Set of Mappable objects
382389
public func <- <T: BaseMappable>(left: inout Set<T>!, right: Map) {
383390
switch right.mappingType {

Sources/TransformOperators.swift

+18-9
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ public func >>> <Transform: TransformType>(left: Transform.Object?, right: (Map,
5454
}
5555

5656

57-
#if !swift(>=4.2)
57+
// Code targeting the Swift 4.1 compiler and below.
58+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
5859
/// Implicitly unwrapped optional object of basic type with Transform
5960
public func <- <Transform: TransformType>(left: inout Transform.Object!, right: (Map, Transform)) {
6061
let (map, transform) = right
@@ -113,7 +114,8 @@ public func >>> <Transform: TransformType>(left: [Transform.Object]?, right: (Ma
113114
}
114115

115116

116-
#if !swift(>=4.2)
117+
// Code targeting the Swift 4.1 compiler and below.
118+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
117119
/// Implicitly unwrapped optional array of Basic type with Transform
118120
public func <- <Transform: TransformType>(left: inout [Transform.Object]!, right: (Map, Transform)) {
119121
let (map, transform) = right
@@ -172,7 +174,8 @@ public func >>> <Transform: TransformType>(left: [String: Transform.Object]?, ri
172174
}
173175

174176

175-
#if !swift(>=4.2)
177+
// Code targeting the Swift 4.1 compiler and below.
178+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
176179
/// Implicitly unwrapped optional dictionary of Basic type with Transform
177180
public func <- <Transform: TransformType>(left: inout [String: Transform.Object]!, right: (Map, Transform)) {
178181
let (map, transform) = right
@@ -233,7 +236,8 @@ public func >>> <Transform: TransformType>(left: Transform.Object?, right: (Map,
233236
}
234237

235238

236-
#if !swift(>=4.2)
239+
// Code targeting the Swift 4.1 compiler and below.
240+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
237241
/// Implicitly unwrapped optional Mappable objects that have transforms
238242
public func <- <Transform: TransformType>(left: inout Transform.Object!, right: (Map, Transform)) where Transform.Object: BaseMappable {
239243
let (map, transform) = right
@@ -292,7 +296,8 @@ public func >>> <Transform: TransformType>(left: Dictionary<String, Transform.Ob
292296
}
293297

294298

295-
#if !swift(>=4.2)
299+
// Code targeting the Swift 4.1 compiler and below.
300+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
296301
/// Implicitly unwrapped Optional Dictionary of Mappable object <String, T: Mappable> with a transform
297302
public func <- <Transform: TransformType>(left: inout Dictionary<String, Transform.Object>!, right: (Map, Transform)) where Transform.Object: BaseMappable {
298303
let (map, transform) = right
@@ -377,7 +382,8 @@ public func >>> <Transform: TransformType>(left: Dictionary<String, [Transform.O
377382
}
378383

379384

380-
#if !swift(>=4.2)
385+
// Code targeting the Swift 4.1 compiler and below.
386+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
381387
/// Implicitly unwrapped Optional Dictionary of Mappable object <String, T: Mappable> with a transform
382388
public func <- <Transform: TransformType>(left: inout Dictionary<String, [Transform.Object]>!, right: (Map, Transform)) where Transform.Object: BaseMappable {
383389
let (map, transform) = right
@@ -447,7 +453,8 @@ public func >>> <Transform: TransformType>(left: Array<Transform.Object>?, right
447453
}
448454

449455

450-
#if !swift(>=4.2)
456+
// Code targeting the Swift 4.1 compiler and below.
457+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
451458
/// Implicitly unwrapped Optional array of Mappable objects
452459
public func <- <Transform: TransformType>(left: inout Array<Transform.Object>!, right: (Map, Transform)) where Transform.Object: BaseMappable {
453460
let (map, transform) = right
@@ -543,7 +550,8 @@ public func >>> <Transform: TransformType>(left: [[Transform.Object]]?, right: (
543550
}
544551

545552

546-
#if !swift(>=4.2)
553+
// Code targeting the Swift 4.1 compiler and below.
554+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
547555
/// Implicitly unwrapped Optional array of array of objects with transform
548556
public func <- <Transform: TransformType>(left: inout [[Transform.Object]]!, right: (Map, Transform)) {
549557
let (map, transform) = right
@@ -618,7 +626,8 @@ public func >>> <Transform: TransformType>(left: Set<Transform.Object>?, right:
618626
}
619627

620628

621-
#if !swift(>=4.2)
629+
// Code targeting the Swift 4.1 compiler and below.
630+
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
622631
/// Implicitly unwrapped Optional set of Mappable objects with transform
623632
public func <- <Transform: TransformType>(left: inout Set<Transform.Object>!, right: (Map, Transform)) where Transform.Object: BaseMappable {
624633
let (map, transform) = right

0 commit comments

Comments
 (0)