From f98ac60239bcc77c5147d79cf707fde863876260 Mon Sep 17 00:00:00 2001 From: "Rui A. Rebelo" Date: Mon, 5 Jul 2021 15:32:50 -0600 Subject: [PATCH] Resolves #14. Unlike all controls, WebView has 'fn did_load(&self,...)' with self as non-mutable --- src/webview/mod.rs | 2 +- src/webview/traits.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webview/mod.rs b/src/webview/mod.rs index 5e39897..455e8df 100644 --- a/src/webview/mod.rs +++ b/src/webview/mod.rs @@ -198,7 +198,7 @@ impl WebView where T: WebViewDelegate + 'static { /// Initializes a new WebView with a given `WebViewDelegate`. This enables you to respond to events /// and customize the view as a module, similar to class-based systems. pub fn with(config: WebViewConfig, delegate: T) -> WebView { - let delegate = Box::new(delegate); + let mut delegate = Box::new(delegate); let objc_delegate = unsafe { let objc_delegate: id = msg_send![register_webview_delegate_class::(), new]; diff --git a/src/webview/traits.rs b/src/webview/traits.rs index 048cf19..af96fd3 100644 --- a/src/webview/traits.rs +++ b/src/webview/traits.rs @@ -11,7 +11,7 @@ pub trait WebViewDelegate { /// Called when the View is ready to work with. You're passed a `ViewHandle` - this is safe to /// store and use repeatedly, but it's not thread safe - any UI calls must be made from the /// main thread! - fn did_load(&self, _webview: WebView) {} + fn did_load(&mut self, _webview: WebView) {} /// Called when this is about to be added to the view heirarchy. fn will_appear(&self) {}