Skip to content

Commit

Permalink
Change compiler directives, in IUO overloads, to target the Swift 4.1…
Browse files Browse the repository at this point in the history
… compiler and below
  • Loading branch information
gcharita committed Jun 14, 2018
1 parent c31a112 commit 5985794
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 28 deletions.
9 changes: 6 additions & 3 deletions Sources/EnumOperators.swift
Expand Up @@ -31,7 +31,8 @@ public func >>> <T: RawRepresentable>(left: T?, right: Map) {
}


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


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


#if !swift(>=4.2)
// Code targeting the Swift 4.1 compiler and below.
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
/// Dictionary of Raw Representable object
public func <- <T: RawRepresentable>(left: inout [String: T]!, right: Map) {
left <- (right, EnumTransform())
Expand Down
21 changes: 14 additions & 7 deletions Sources/FromJSON.swift
Expand Up @@ -40,7 +40,8 @@ internal final class FromJSON {
field = object
}

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

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

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

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

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

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

#if !swift(>=4.2)
// Code targeting the Swift 4.1 compiler and below.
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
/// Implicitly unwrapped optional mappable object array
class func optionalObjectSet<N: BaseMappable>(_ field: inout Set<N>!, map: Map) {
field = Mapper(context: map.context).mapSet(JSONObject: map.currentValue)
Expand Down
6 changes: 4 additions & 2 deletions Sources/IntegerOperators.swift
Expand Up @@ -34,7 +34,8 @@ public func <- <T: SignedInteger>(left: inout T?, right: Map) {
}
}

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

#if !swift(>=4.2)
// Code targeting the Swift 4.1 compiler and below.
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
/// ImplicitlyUnwrappedOptional UnsignedInteger mapping
public func <- <T: UnsignedInteger>(left: inout T!, right: Map) {
switch right.mappingType {
Expand Down
21 changes: 14 additions & 7 deletions Sources/Operators.swift
Expand Up @@ -76,7 +76,8 @@ public func >>> <T>(left: T?, right: Map) {
}


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


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


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


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


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


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


#if !swift(>=4.2)
// Code targeting the Swift 4.1 compiler and below.
#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0)))
/// Implicitly unwrapped Optional Set of Mappable objects
public func <- <T: BaseMappable>(left: inout Set<T>!, right: Map) {
switch right.mappingType {
Expand Down
27 changes: 18 additions & 9 deletions Sources/TransformOperators.swift
Expand Up @@ -54,7 +54,8 @@ public func >>> <Transform: TransformType>(left: Transform.Object?, right: (Map,
}


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


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


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


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


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


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


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


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


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

0 comments on commit 5985794

Please sign in to comment.