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) {}