Skip to content

Commit 10bcb55

Browse files
committed
Refactored the implementation of enum array mapping
1 parent 61552a9 commit 10bcb55

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

ObjectMapper/Core/FromJSON.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ internal final class FromJSON {
5353
/// Array of Raw representable
5454
class func rawRepresentableArray<N: RawRepresentable>(inout field: [N], object: [N.RawValue]?) {
5555
if let values = object {
56-
field = values.reduce([N]()) { (var vs, v) in
57-
vs.append(N(rawValue: v)!)
58-
return vs
56+
field = values.map { (v: N.RawValue) in N(rawValue: v)! }
5957
}
6058
}
6159

0 commit comments

Comments
 (0)