Skip to content

Instantly share code, notes, and snippets.

@GE-N
Created July 26, 2015 08:01
Show Gist options
  • Save GE-N/e72fbb4867135c3eafbf to your computer and use it in GitHub Desktop.
Save GE-N/e72fbb4867135c3eafbf to your computer and use it in GitHub Desktop.
Configure hosting by Swift's enum
enum Host {
case Staging = “http://staging.myblog.com/api”
case Production = “https://myblog.com/api”
}
class API {
class var host: Host
func blog(…) -> (…) {
let apiPath = “\(API.host.rawValue)/blog”
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment