RestingPathVariableProvider
public class RestingPathVariableProvider : PathVariableProvider
A default implementation of HeaderProvider supporting dynamic variable provisioning.
-
The varaibles to provide to a request on a given time. Generated from
providers, discartingnilvalues.Declaration
Swift
public var variables: [String : Any] { get } -
Creates a new
RestingPathVariableProviderwith the given variable callbacks.Declaration
Swift
public init(providers: [String : () -> (Any?)] = [:])Parameters
providersThe callbacks to generate variable values for requests. Keys indicate the name and the return of the callback the value of the variable to add.
nilvalues are discarted. -
Adds a static variable value for the given key.
Adding a variable to an existing overrides the previous one.
Declaration
Swift
public func addVariable(key: String, value: Any)Parameters
keyThe name of the variable.
valueThe value of the variable.
-
Adds a dynamic variable value for the given key.
Adding a variable to an existing overrides the previous one.
Declaration
Swift
public func addVariable(key: String, provider: @escaping () -> Any?)Parameters
keyThe name of the variable.
providerThe provider to call for the varible value.
nilvalues are discarted. -
Removes a variable added for the given key.
Declaration
Swift
public func removeVariable(for key: String)Parameters
keyThe name of the variable to remove.
RestingPathVariableProvider Class Reference