Last active
December 17, 2018 16:51
-
-
Save alexisakers/173f9abd92af9e782a95d1366bf52cd1 to your computer and use it in GitHub Desktop.
Example BLTNItem for displaying a web view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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