JWAdBreakBuilder
@objcMembers
public final class JWAdBreakBuilder : NSObject, JWBuilder, JWJSONDecodable
The builder for JWAdBreak.
-
Declaration
Swift
public typealias Output = JWAdBreak
-
Undocumented
Declaration
Swift
public override init()
-
Returns a
JWAdBreakBuilder
instance with initial values equal to a valid JSON representation of an ad break.These values can still be subsequently assigned. For example, to have a copy of a preroll in the postroll slot, retaining ad tag url etc.:
let myPostroll = try! JWAdBreakBuilder(from: myPrerollJsonObject) .offset(.postroll()) .build()
Declaration
Swift
public convenience init?(from json: JSONObject)
Parameters
json
The
JSONObject
from which the builder will copy values. Must be valid. -
Returns a new
JWAdBreakBuilder
instance with initial values equal to an existing ad break object.These values can still be subsequently assigned. For example, to have a copy of a preroll in the postroll slot, retaining ad tag url etc.:
// myPreroll is a JWAdBreak let myPostroll = try! JWAdBreakBuilder(from: myPreroll) .offset(.postroll()) .build()
Declaration
Swift
public init(from adBreak: JWAdBreak? = nil)
Parameters
adBreak
The
JWAdBreak
object from which the builder will copy values. -
Builds an ad break based off the settings provided.
Throws
throws An error if the ad break is not setup properly.Declaration
Swift
public func build() throws -> JWAdBreak
-
Sets an array of ad urls.
Declaration
Swift
@discardableResult public func tags(_ tags: [URL]) -> JWAdBreakBuilder
Parameters
tags
An array of VAST ad urls.
Return Value
The builder, so setters can be chained.
-
Sets the offset of the ad break. The default value is
.pre
.Declaration
Swift
@discardableResult public func offset(_ offset: JWAdOffset) -> JWAdBreakBuilder
Parameters
offset
The offset of the ad break.
Return Value
The builder, so setters can be chained.
-
Sets the number of seconds to wait before enabling the skip button.
The value set here will take priority over any value set in
JWAdvertisingConfig
, in the VAST XML, or inJWAdInterfaceStyle
.Declaration
Swift
@discardableResult public func skipOffset(_ offset: TimeInterval) -> JWAdBreakBuilder
Parameters
offset
The number of seconds to wait before enabling the skip ad button.
Return Value
The builder, so setters can be chained.