Created
November 17, 2014 03:16
-
-
Save aGupieWare/a5b73dde57c210f78e1f to your computer and use it in GitHub Desktop.
Swift client, url for item with description . . .
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
| // extract the first two characters of an item's id // | |
| let rangeOfHello = Range(start: itemID.startIndex, end: advance(itemID.startIndex, 2)) | |
| let prefixItemID = itemID.substringWithRange(rangeOfHello) | |
| var url : NSURL? | |
| switch prefixItemID | |
| { | |
| case "PT": | |
| let filePath : String = "http://localhost:8888/api/v1/plumbing_tools/\(itemID).json" | |
| url = NSURL(string: filePath) | |
| case "CP": | |
| let filePath : String = "http://localhost:8888/api/v1/copper_pipes_and_fittings/\(itemID).json" | |
| url = NSURL(string: filePath) | |
| default: | |
| url = NSURL(string: "") | |
| } | |
| return url; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment