Skip to content

Instantly share code, notes, and snippets.

@alexisakers
Last active December 17, 2018 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexisakers/173f9abd92af9e782a95d1366bf52cd1 to your computer and use it in GitHub Desktop.
Save alexisakers/173f9abd92af9e782a95d1366bf52cd1 to your computer and use it in GitHub Desktop.
Example BLTNItem for displaying a web view
import BLTNBoard
import WebKit
class BLTNWebPageItem: FeedbackPageBLTNItem {
let url: URL
init(url: URL) {
self.url = url
super.init(title: "Web Page")
isDismissable = false
actionButtonTitle = "Continue"
}
// MARK: - Interface
var webView: WKWebView?
override func makeViewsUnderDescription(with interfaceBuilder: BLTNInterfaceBuilder) -> [UIView]? {
let webView = WKWebView()
webView.backgroundColor = .white
let webViewWrapper = interfaceBuilder.wrapView(webView, width: nil, height: 256, position: .pinnedToEdges)
self.webView = webView
return [webViewWrapper]
}
override func willDisplay() {
super.willDisplay()
let request = URLRequest(url: url)
webView?.load(request)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment