Skip to content

Commit

Permalink
no double cast
Browse files Browse the repository at this point in the history
  • Loading branch information
evermeer committed Dec 26, 2016
1 parent 84d51b2 commit adcc2a3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion EVReflection.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Pod::Spec.new do |s|
#

s.name = "EVReflection"
s.version = "3.5.1"
s.version = "3.5.2"
s.summary = "iOS: Swift helper library with reflection functions"
s.description = "Swift helper library with reflection functions including support for NSCoding, Printable, Hashable, Equatable and JSON"
s.homepage = "https://github.com/evermeer/EVReflection"
Expand Down
4 changes: 2 additions & 2 deletions EVReflection/EVReflectionTests/EVReflectionIssue145.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class User145c: EVObject {
var id: Int = 0
var name: String = ""
var email: String?
var company: AnyObject = NSDictionary()
var workHistory: [AnyObject] = []
var company: AnyObject? = NSDictionary()
var workHistory: [AnyObject]? = []
}

class Company145: EVObject {
Expand Down
2 changes: 1 addition & 1 deletion EVReflection/EVReflectionTests/EVReflectionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class EVReflectionTests: XCTestCase {
*/
func testArrays() {
let x = ArrayObjects()
print(x.toJsonString())
print(x)
}

func testCircular() {
Expand Down
4 changes: 4 additions & 0 deletions EVReflection/EVReflectionTests/TestObjects.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ class ArrayObjects: EVObject {
var arrays: [[String]] = [["a","b"], ["c","d"]]
var dictionaries: [NSDictionary] = [NSDictionary(), NSDictionary()]
var subobjects: [SubObject] = [SubObject(), SubObject()]
var nilObjects: [SubObject]?
var nilStrings: [String]?
var nilObjectsForced: [SubObject]!
var nilStringsForced: [String]!
}

class SubObject: EVObject {
Expand Down
20 changes: 10 additions & 10 deletions EVReflection/pod/EVReflection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -745,40 +745,40 @@ final public class EVReflection {
return (theValue as! NSNumber, "NSNumber", false)
}
if theValue is Int64 {
return (NSNumber(value: theValue as! Int64 as Int64), "NSNumber", false)
return (NSNumber(value: theValue as! Int64), "NSNumber", false)
}
if theValue is UInt64 {
return (NSNumber(value: theValue as! UInt64 as UInt64), "NSNumber", false)
return (NSNumber(value: theValue as! UInt64), "NSNumber", false)
}
if theValue is Int32 {
return (NSNumber(value: theValue as! Int32 as Int32), "NSNumber", false)
return (NSNumber(value: theValue as! Int32), "NSNumber", false)
}
if theValue is UInt32 {
return (NSNumber(value: theValue as! UInt32 as UInt32), "NSNumber", false)
return (NSNumber(value: theValue as! UInt32), "NSNumber", false)
}
if theValue is Int16 {
return (NSNumber(value: theValue as! Int16 as Int16), "NSNumber", false)
return (NSNumber(value: theValue as! Int16), "NSNumber", false)
}
if theValue is UInt16 {
return (NSNumber(value: theValue as! UInt16 as UInt16), "NSNumber", false)
return (NSNumber(value: theValue as! UInt16), "NSNumber", false)
}
if theValue is Int8 {
return (NSNumber(value: theValue as! Int8 as Int8), "NSNumber", false)
return (NSNumber(value: theValue as! Int8), "NSNumber", false)
}
if theValue is UInt8 {
return (NSNumber(value: theValue as! UInt8 as UInt8), "NSNumber", false)
return (NSNumber(value: theValue as! UInt8), "NSNumber", false)
}
if theValue is NSString {
return (theValue as! NSString, "NSString", false)
}
if theValue is Date {
return (theValue as! Date as AnyObject, "NSDate", false)
return (theValue as AnyObject, "NSDate", false)
}
if theValue is UUID {
return ((theValue as! UUID).uuidString as AnyObject, "NSString", false)
}
if theValue is Array<Any> {
return ((theValue as! Array<Any>) as AnyObject, valueType, false)
return (theValue as AnyObject, valueType, false)
}
if theValue is EVReflectable && theValue is NSObject {
if valueType.contains("<") {
Expand Down

0 comments on commit adcc2a3

Please sign in to comment.