Skip to content

Commit

Permalink
Xcode 7.3 optional support
Browse files Browse the repository at this point in the history
change order of switch statement so that Int? is considered last
  • Loading branch information
jondwillis committed Mar 25, 2016
1 parent 423134d commit 9811b10
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions JSONHelper/JSONHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ public func <-- <T>(inout property: T?, value: AnyObject?) -> T? {
} else {
// Convert by processing the value first.
switch property {
case is Int?:
if unwrappedValue is String {
if let intValue = Int("\(unwrappedValue)") {
newValue = intValue as? T
}
}
case is NSURL?:
newValue = NSURL(string: "\(unwrappedValue)") as? T
case is NSDate?:
Expand All @@ -79,6 +73,12 @@ public func <-- <T>(inout property: T?, value: AnyObject?) -> T? {
} else if let timestamp = unwrappedValue as? NSNumber {
newValue = NSDate(timeIntervalSince1970: timestamp.doubleValue) as? T
}
case is Int?:
if unwrappedValue is String {
if let intValue = Int("\(unwrappedValue)") {
newValue = intValue as? T
}
}
default:
break
}
Expand Down

0 comments on commit 9811b10

Please sign in to comment.