Last active
September 3, 2018 03:46
-
-
Save balitax/f327d871f5fe6a4259213dba22651f92 to your computer and use it in GitHub Desktop.
APIEnvironment.swift
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
// | |
// 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