From 03cf0167d5fdf60eb3201dcd1f3c6286fcd0152d Mon Sep 17 00:00:00 2001 From: Joe Masilotti Date: Sun, 15 Dec 2024 09:50:26 -0800 Subject: [PATCH] Document makeCustomWebView w/ bridge components --- Source/HotwireConfig.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Source/HotwireConfig.swift b/Source/HotwireConfig.swift index b7ea101..375703d 100644 --- a/Source/HotwireConfig.swift +++ b/Source/HotwireConfig.swift @@ -42,7 +42,19 @@ public struct HotwireConfig { } /// Optionally customize the web views used by each Turbo Session. + /// /// Ensure you return a new instance each time. + /// Make sure to call `Bridge.initialize(webView)` if you are using bridge + /// components and call this *after* `Hotwire.registerBridgeComponents()`. + /// + /// ```swift + /// Hotwire.config.makeCustomWebView = { config in + /// let webView = WKWebView(frame: .zero, configuration: config) + /// Bridge.initialize(webView) + /// // Customize web view... + /// return webView + /// } + /// ``` public var makeCustomWebView: WebViewBlock = { (configuration: WKWebViewConfiguration) in WKWebView.debugInspectable(configuration: configuration) }