RichieAdsController
@MainActor
public final class RichieAdsController
RichieAdsController
is the main interface for loading ads with Richie SDK.
If possible, you should be using this class instead of RichieAds
. RichieAds
does not force usage from the main thread but strongly recommends it; this class
forces the issue and defines itself to work on the main actor.
-
Initialize
RichieAdsController
.Declaration
Swift
public convenience init( appIdentifier: String )
-
This method should be called before relinquishing last reference to a RichieAds instance. It allows RichieAds to nicely shut down and clean up.
Declaration
Swift
public func invalidate()
-
Global persisted parameters can be used by ad creatives (using JavaScript API) to query global state. This gives creatives the opportunity to communicate with each other, using simple string values. For example, one creative can set a value for a key when some action has been performed by the user, and then another creative can know that this event has occurred.
Note
Parameters are retained only for a limited duration. They will be cleaned after 30 days of inuse.Declaration
Swift
func setGlobalPersistedParameter(key: String, value: String?)
-
Returns value for a global persisted parameter.
Declaration
Swift
func globalPersistedParameterValue(key: String) -> String?
-
This method exists for backwards compatibility, but should be considered soft deprecated. See
nextFlightForSlots(slotIdentifiers:)
for a direct replacement.Declaration
Swift
func nextFlightForSlot(slotIdentifier: String) -> RichieAdsSlotAdFlight?
-
A variable number of arguments variant of
nextFlightForSlots(slotIdentifiers:)-1gsry
. See that method’s documentation for details.Declaration
Swift
func nextFlightForSlots(slotIdentifiers: String...) -> RichieAdsSlotAdFlight?
-
Returns an ad flight when slot display logic indicates it’s time to show an ad. For example, this method might be called for each page view in an app, but it could return an instance once in three calls.
Instances returned from this method must be either shown to the user or released as quickly as possible, when it is known that the flight will not be shown to the user. This allows internal counters and logic to reserve view counts, but return them back to the slot when a flight won’t be shown.
The slot identifiers are attempted in order, and the first non-nil flight is returned.
See also
nextFlightForSlots(slotIdentifiers:)
if you prefer an interface that accepts a variable number of arguments.Declaration
Swift
func nextFlightForSlots(slotIdentifiers: [String]) -> RichieAdsSlotAdFlight?
-
Create an ad view from
adFlight
.Declaration
Swift
func view( frame: CGRect, adFlight: RichieAdsSlotAdFlight, delegate: any RichieAdsViewDelegate, parameters: [String: String]? = nil ) -> RichieAdsView?