Skip to content

Commit

Permalink
🍎 Fix macOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
phatblat committed Feb 6, 2022
1 parent 5066b89 commit b61934e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions Sources/WebView/WebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,24 @@ public struct WebView: View {
}
}

#if os(iOS)
// MARK: - UIViewRepresentable
#if os(iOS)
extension WebView: UIViewRepresentable {
public func makeUIView(context: UIViewRepresentableContext<WebView>) -> WKWebView {
webView
}

public func updateUIView(_ view: WKWebView, context: UIViewRepresentableContext<WebView>) {

}
public func updateUIView(_ view: WKWebView, context: UIViewRepresentableContext<WebView>) {}
}
#endif

#if os(macOS)
// MARK: - NSViewRepresentable
#if os(macOS)
extension WebView: NSViewRepresentable {
public typealias NSViewType = NSViewContainerView<WKWebView>

public func makeNSView(context: NSViewRepresentableContext<WebView>) -> WKWebView {
webView
}

public func updateNSView(_ view: WKWebView, context: UIViewRepresentableContext<WebView>) {
}
public func updateNSView(_ view: WKWebView, context: NSViewRepresentableContext<WebView>) {}
}
#endif

0 comments on commit b61934e

Please sign in to comment.