TNEnvironment

open class TNEnvironment

The TNEnvironment contains information about host, port, configuration and it’s used in TNRequest instances.

Public Properties

Static members

  • The current global environment. Use this property to set your environment globally.

    Declaration

    Swift

    public static var current: TNEnvironment!
  • Set a global environment for TermiNetwork.

    Declaration

    Swift

    public static func set(_ environment: TNEnvironmentProtocol)

    Parameters

    environment

    An enum case type that impleements the TNEnvironmentProtocol.

  • Set a global environment for TermiNetwork with a given environment object.

    Declaration

    Swift

    public static func set(environmentObject: TNEnvironment)

    Parameters

    environment

    A TNEnvironment object.

Initializers

  • Initializes an environment.

    Declaration

    Swift

    public init(scheme: TNURLScheme,
                host: String,
                suffix: TNPath? = nil,
                port: Int? = nil,
                configuration: TNConfiguration? = 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 route

  • Initializes an environment with an URL string.

    Declaration

    Swift

    public init(url: String,
                configuration: TNConfiguration? = nil)

    Parameters

    url

    The scheme of the host (.http or .https)

Extensions

  • Get the String value of the environment.

    Declaration

    Swift

    public var stringURL: String { get }