Resolves #14. Unlike all controls, WebView has 'fn did_load(&self,...)' with self as non-mutable

This commit is contained in:
Rui A. Rebelo 2021-07-05 15:32:50 -06:00
parent 2f7ebbf2ad
commit f98ac60239
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 /// 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. /// and customize the view as a module, similar to class-based systems.
pub fn with(config: WebViewConfig, delegate: T) -> WebView<T> { 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 = unsafe {
let objc_delegate: id = msg_send![register_webview_delegate_class::<T>(), new]; 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 /// 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 /// store and use repeatedly, but it's not thread safe - any UI calls must be made from the
/// main thread! /// 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. /// Called when this is about to be added to the view heirarchy.
fn will_appear(&self) {} fn will_appear(&self) {}