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
environment
An 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
environment
A Environment object.
-
Initializes an environment.
Declaration
Swift
public init(scheme: URLScheme, host: String, suffix: Path? = nil, port: Int? = nil, configuration: Configuration? = nil)
Parameters
scheme
The scheme of the host (.http or .https)
host
The host name, e.g. s1.example.com
suffix
The path after the host name, e.g. .path[“api”,“v1”]
port
The port the environment is using, e.g. 8080
configuration
A 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
url
The scheme of the host (.http or .https)
-
Get the String value of the environment.
Declaration
Swift
public var stringURL: String { get }