From 33aa6bf3ae2b6b699d10e2afd4b89d372e473c4c Mon Sep 17 00:00:00 2001 From: Brentley Jones Date: Mon, 21 Nov 2016 11:33:50 -0600 Subject: [PATCH] Fix casting for `anyArray` When a type can't become `AnyObject` (some Swift structs for example) this would end up throwing a typeMismatch error. --- Sources/ValueType.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/ValueType.swift b/Sources/ValueType.swift index d13007e..d05420b 100644 --- a/Sources/ValueType.swift +++ b/Sources/ValueType.swift @@ -50,7 +50,7 @@ extension Int64: ValueType { extension Array where Element: ValueType { public static func value(from object: Any, discardingErrors: Bool = false) throws -> [Element] { - guard let anyArray = object as? [AnyObject] else { + guard let anyArray = object as? [Any] else { throw MarshalError.typeMismatch(expected: self, actual: type(of: object)) } @@ -75,7 +75,7 @@ extension Array where Element: ValueType { } public static func value(from object: Any) throws -> [Element?] { - guard let anyArray = object as? [AnyObject] else { + guard let anyArray = object as? [Any] else { throw MarshalError.typeMismatch(expected: self, actual: type(of: object)) } return anyArray.map {