Skip to content

Commit

Permalink
Merge pull request #59 from hotwired/fix-bridge-registration
Browse files Browse the repository at this point in the history
Fix bridge registration
  • Loading branch information
svara authored Dec 16, 2024
2 parents fe0558d + f831370 commit 21313e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 0 additions & 6 deletions Source/Hotwire.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ public enum Hotwire {
/// configuration further, making sure to call `Bridge.initialize()`.
public static func registerBridgeComponents(_ componentTypes: [BridgeComponent.Type]) {
bridgeComponentTypes = componentTypes

Hotwire.config.makeCustomWebView = { configuration in
let webView = WKWebView.debugInspectable(configuration: configuration)
Bridge.initialize(webView)
return webView
}
}


Expand Down
8 changes: 7 additions & 1 deletion Source/HotwireConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ public struct HotwireConfig {
// MARK: - Internal

public func makeWebView() -> WKWebView {
makeCustomWebView(makeWebViewConfiguration())
let webView = makeCustomWebView(makeWebViewConfiguration())

if !Hotwire.bridgeComponentTypes.isEmpty {
Bridge.initialize(webView)
}

return webView
}

// MARK: - Private
Expand Down

0 comments on commit 21313e4

Please sign in to comment.