Created
October 21, 2016 14:04
-
-
Save odrobnik/c6681587dd210b5ffe327babe51e2618 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func ~= <T>(lhs: inout T?, object: Any?) | |
{ | |
lhs = object as? T | |
} | |
func ~= (lhs: inout URL?, object: Any?) | |
{ | |
if let string = object as? String | |
{ | |
lhs = URL(string: string) | |
} | |
else | |
{ | |
lhs ~= object | |
} | |
} | |
func ~= (lhs: inout Date?, object: Any?) | |
{ | |
if let timestamp = object as? Int | |
{ | |
lhs = Date(timeIntervalSince1970: TimeInterval(timestamp/1000)) | |
} | |
else | |
{ | |
lhs ~= object | |
} | |
} | |
startDate ~= dictionary["startTimestamp"] | |
endDate ~= dictionary["endTimestamp"] | |
clientName ~= dictionary["clientName"] | |
providerName ~= dictionary["providerName"] | |
roomID ~= dictionary["roomId"] | |
productPictureURL ~= dictionary["productPictureUrl"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment