Environment
open class Environment
The Environment contains information about host, port, configuration and it’s used in Request instances.
-
The configuration object.
Declaration
Swift
public var configuration: Configuration?
-
The current global environment. Use this property to set your environment globally.
Declaration
Swift
public static var current: Environment! -
Set a global environment for TermiNetwork.
Declaration
Swift
public static func set(_ environment: EnvironmentProtocol)Parameters
environmentAn enum case type that impleements the EnvironmentProtocol.
-
Set a global environment for TermiNetwork with a given environment object.
Declaration
Swift
public static func set(environmentObject: Environment)Parameters
environmentA Environment object.
-
Initializes an environment.
Declaration
Swift
public init(scheme: URLScheme, host: String, suffix: Path? = nil, port: Int? = nil, configuration: Configuration? = nil)Parameters
schemeThe scheme of the host (.http or .https)
hostThe host name, e.g. s1.example.com
suffixThe path after the host name, e.g. .path[“api”,“v1”]
portThe port the environment is using, e.g. 8080
configurationA configuration instance that will be inherited by each request and repository.
-
Initializes an environment with an URL string.
Declaration
Swift
public init(url: String, configuration: Configuration? = nil)Parameters
urlThe scheme of the host (.http or .https)
-
Get the String value of the environment.
Declaration
Swift
public var stringURL: String { get }
View on GitHub
Install in Dash
Environment Class Reference