Merge pull request #15 from rrebelo62/trunk

Fixes issue #14: Unlike all controls, WebView has 'fn did_load(&self, …)' with self as non-mutable
This commit is contained in:
Ryan McGrath 2021-07-06 19:04:14 -07:00 committed by GitHub
commit 87eda8f94a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -198,7 +198,7 @@ impl<T> WebView<T> 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<T> {
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::<T>(), new];

View file

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