Imported from sprnxt/feed-demo-uikit (
AGENTS.md). Install upstream withnpx skills add sprnxt/feed-demo-uikit. Copyright stays with the author.
Notes for AI agents
This is a demo of embedding the SuperNext / GreenVideo feed (<sn-feed> web component) in an
iOS app via a WKWebView. This variant uses UIKit.
Source of truth
The entire integration is in one self-contained file:
FeedDemoUIKit/ViewController.swift
Read it in full before reproducing the integration. It contains:
- the embed values —
licenseKey,embedId,urlStaging, and thefeedHtmltemplate - the
WKWebViewConfigurationand theWKWebView loadHTMLStringinviewDidLoad()
The WKWebView is an ordinary UIView. The demo makes it the controller's whole view via
loadView() for simplicity, but that's not required — it can be added as a subview with Auto Layout
to occupy only part of a screen. Nothing about the feed integration depends on it being full-screen.
README.md explains why each piece matters; ViewController.swift is the what. The README snippets are excerpts, not the complete code.
Non-obvious requirements (don't drop these)
loadHTMLString(_:baseURL:)usesbaseURL: nil(null/opaque origin, same as the Android demo'sloadData(...)). The external ES module still loads thanks to thegf.jsCDN's permissive cross-domain CORS. Optional production-fidelity tweak: pass a real https baseURL, e.g.URL(string: "https://example.com"), for workinglocalStorage/cookies and credentialed CORS.configuration.allowsInlineMediaPlayback = true— without it, tapping a video forces the native fullscreen player instead of playing inline in the feed.configuration.mediaTypesRequiringUserActionForPlayback = []— needed for autoplay (optional otherwise).type="module"andasyncon the<script>tag are required — the loader is an ES module.- JavaScript is enabled by default in
WKWebView— there is no equivalent of Android'sjavaScriptEnabledflag to set. - The feed loads over HTTPS, which App Transport Security permits by default — no
Info.plist/ ATS exception is needed.