Created
June 7, 2016 18:13
-
-
Save welbesw/d829ddf0523fd9261febb6d0a17b1b41 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
public class SalesforceContact { | |
public var id: String? | |
public var firstName: String? | |
public var lastName: String? | |
public var email: String? | |
//Method to initialize with JSON dict returned by the API | |
public init(dictionary: [String : AnyObject]) { | |
//Iterate over every item in the dictionary | |
for(key, value) in dictionary { | |
switch key.lowercaseString { | |
case "id": | |
self.id = value as? String | |
case "firstname": | |
self.firstName = value as? String | |
case "lastname": | |
self.lastName = value as? String | |
case "email": | |
self.email = value as? String | |
default: | |
//print("SalesforceContact field: \(key)") | |
break | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment