Skip to content

Commit

Permalink
✨ Add KeyPath subscripting
Browse files Browse the repository at this point in the history
  • Loading branch information
phatblat committed Feb 6, 2022
1 parent e92f295 commit 6cc5532
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/WebView/WebViewStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public class WebViewStore: ObservableObject {
setupObservers()
}

/// Enables KeyPath access to wrapped WKWebView properties.
public subscript<T>(keyPath: KeyPath<WKWebView, T>) -> T {
webView[keyPath: keyPath]
}

deinit {
observers.forEach {
// Not even sure if this is required?
Expand Down

0 comments on commit 6cc5532

Please sign in to comment.