Skip to main content

iOS Client-Side Offer Feed

Render the SDK's offers in your own UI, and hand selections back to the SDK's screens.

Overview​

The offer wall (OffersWallViewController) is a complete, SDK-rendered screen. The Client-Side Offer Feed is the alternative for hosts that want full control over presentation: BlinkEngageSDK.loadOfferFeed(completion:) returns the same offers as plain data — groups, each with its offers — for the host to lay out natively. Two entry points return SDK screens for a selection, so tapping a host-rendered offer still lands on the SDK's detail experience.


How It Works​

  1. Call BlinkEngageSDK.shared.loadOfferFeed(completion:) — typically on screen appearance. Concurrent calls share one request, so this is safe to call eagerly.
  2. Render the feed's groups in your own UI. Each BlinkEngageOfferGroup carries its title and offers.
  3. On selection, exchange the tapped object for an SDK screen: offerDetailsViewController(for:) for a single offer, or offerGroupViewController(for:) for a whole group. Present or push the returned controller from your own navigation.
  4. Reload the feed when it may be stale (for example on foreground). The entry points resolve against the most recent successful load and return nil for objects that are no longer part of it — reload and rebuild rather than caching feed objects long-term.

Errors​

The completion returns either a feed or an error in domain BlinkEngageOfferFeed:

CodeMeaningSuggested handling
1No registered user, and no registration in progressCheck the SDK is started and a user identity is set. (A call during first-launch registration does not produce this — it waits.)
2Feed unavailableThe fetch failed or the feature is disabled remotely — treat as off; do not retry in a loop.

A call made while the first-launch registration is still in flight waits for it rather than failing, so the first completion can take a moment longer. An empty feed is a success, not an error — the feed can legitimately contain zero groups.

Remotely disabling the feed produces code 2, never an empty feed, so "disabled" and "no offers right now" stay distinguishable.


Reporting Interactions​

Your app renders the feed, so only it knows when an offer was seen or tapped. Report those interactions with BlinkEngageSDK.shared.reportOfferFeedEvent(_:):

InteractionWhen to report
didAppearAn offer became visible — for example from collectionView(_:willDisplay:forItemAt:). Report every offer that becomes visible, every time; loading the feed is not itself an offer view.
didTapAt the same moment you open offerDetailsViewController(for:).
viewAllAt the same moment you open offerGroupViewController(for:), whatever your control for it looks like.

Pass the group itself for View all; the SDK records its position in the feed it handed you, so your own section numbering can be filtered or reordered freely.

Swift​

BlinkEngageSDK.shared.reportOfferFeedEvent(
BlinkEngageOfferFeedEvent(offer: offer, type: .didAppear)
)
BlinkEngageSDK.shared.reportOfferFeedEvent(
BlinkEngageOfferFeedEvent(offer: offer, type: .didTap)
)
BlinkEngageSDK.shared.reportOfferFeedEvent(
BlinkEngageOfferFeedEvent(group: group, type: .viewAll)
)

Objective-C​

[sdk reportOfferFeedEvent:[[BlinkEngageOfferFeedEvent alloc] initWithOffer:offer type:BlinkEngageOfferFeedEventTypeDidAppear]];
[sdk reportOfferFeedEvent:[[BlinkEngageOfferFeedEvent alloc] initWithOffer:offer type:BlinkEngageOfferFeedEventTypeDidTap]];
[sdk reportOfferFeedEvent:[[BlinkEngageOfferFeedEvent alloc] initWithGroup:group type:BlinkEngageOfferFeedEventTypeViewAll]];