Last active
December 5, 2018 19:32
-
-
Save alexbaramilis/9782946ce7c90857fa970f8872fcdb39 to your computer and use it in GitHub Desktop.
Namespacing with enums 1
This file contains 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
struct API1 { | |
static let BaseURL = "api.airvisual.com/v2/nearest_city?lat={{LATITUDE}}&lon={{LONGITUDE}}&key={{YOUR_API_KEY}}" | |
static let Key = "your_api_key" | |
} | |
enum API2 { | |
static let BaseURL = "api.airvisual.com/v2/nearest_city?lat={{LATITUDE}}&lon={{LONGITUDE}}&key={{YOUR_API_KEY}}" | |
static let Key = "your_api_key" | |
} | |
let baseURL1 = API1.BaseURL | |
let baseURL2 = API2.BaseURL | |
let api1 = API1() | |
let api2 = API2() // Compiler Error: 'API2' cannot be constructed because it has no accessible initializers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment