Skip to content

Instantly share code, notes, and snippets.

@balitax
Last active September 3, 2018 03:46
Show Gist options
  • Save balitax/f327d871f5fe6a4259213dba22651f92 to your computer and use it in GitHub Desktop.
Save balitax/f327d871f5fe6a4259213dba22651f92 to your computer and use it in GitHub Desktop.
APIEnvironment.swift
//
// APIEnvironment.swift
// DOT APIEnvironment
//
// Created by Agus Cahyono on 07/08/18.
// Copyright © 2018 Agus Cahyono. All rights reserved.
//
import Foundation
enum APIEnvironment {
case development
case staging
case production
}
extension APIEnvironment {
static var baseURL = ""
static let serviceName: String = "com.dot.yourappname"
static var environment: APIEnvironment = .staging {
didSet {
if environment == .development {
APIEnvironment.developmentEnv()
} else if environment == .staging {
APIEnvironment.stagingEnv()
} else if environment == .production {
APIEnvironment.prodEnv()
}
}
}
static func developmentEnv() {
APIEnvironment.baseURL = ""
}
static func stagingEnv() {
APIEnvironment.baseURL = ""
}
static func prodEnv() {
APIEnvironment.baseURL = ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment