VastMacroConfig
@objc(BMPVastMacroConfig)
@objcMembers
public class VastMacroConfig : NSObject
Contains configuration options for VAST macros.
-
Type alias for VAST macro value provider.
Note
macro.name
is case sensitive. To handle case insensitivity, convert the name to lowercase before comparing.Returned values will be URL encoded before replacing the VAST macro in the ad tag and tracking URLs. To return combined values of the provided values and custom values, return an array of values combining both. Returned values will override the values provided. Return empty array to omit values provided via
macro.values
. Returnmacro.values
to use the values provided unchanged.Example:
vastMacroConfig.valueProvider = { macro, context in switch macro.name { case "CUSTOMMACRO": // return static values return ["custom value"] case "PLAYERMACRO": // return the provided values unchanged return macro.values case "CONTEXTAWARE": // return values based on the context return context.kind == .tracking ? ["value for tracking"] : ["value for ad tag"] case "OVERRIDEPLAYERMACRO": // return values overriding the provided value return ["overridden value"] case "COMBINEDMACRO": // return combined values of the provided values and custom values return macro.values + ["overridden value"] default: // return the provided values unchanged for any unhandled macros return macro.values } }
Declaration
Swift
public typealias VastMacroValueProvider = (_ macro: VastMacro, _ context: VastMacroContext) -> [String]
Parameters
macro
The VAST macro to resolve. See
VastMacro
for details.context
The context to resolve the VAST macro in.
Return Value
The resolved values for the VAST macro.
-
Value provider for VAST macros.
The returned values are used to replace the VAST macros in the ad tag and tracking URLs. See
VastMacroValueProvider
for details.Note
The value provider is called for each VAST macro in the ad tag and tracking URLs.Declaration
Swift
public var valueProvider: VastMacroValueProvider?