Skip to content

Commit

Permalink
fix(ios): navigation delegate class name conflict (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
pewsheen committed Dec 27, 2022
1 parent 3cdfd0b commit fca42a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/navigation-delegate-class-name-conflict.md
@@ -0,0 +1,5 @@
---
"wry": patch
---

Change class declare name from `UIViewController` to `WryNavigationDelegate` to avoid class name conflict on iOS.
5 changes: 3 additions & 2 deletions src/webview/wkwebview/mod.rs
Expand Up @@ -468,7 +468,8 @@ impl InnerWebView {

let pending_scripts = Arc::new(Mutex::new(Some(Vec::new())));

let navigation_delegate_cls = match ClassDecl::new("UIViewController", class!(NSObject)) {
let navigation_delegate_cls = match ClassDecl::new("WryNavigationDelegate", class!(NSObject))
{
Some(mut cls) => {
cls.add_ivar::<*mut c_void>("pending_scripts");
cls.add_ivar::<*mut c_void>("navigation_policy_function");
Expand All @@ -488,7 +489,7 @@ impl InnerWebView {
add_download_methods(&mut cls);
cls.register()
}
None => class!(UIViewController),
None => class!(WryNavigationDelegate),
};

let navigation_policy_handler: id = msg_send![navigation_delegate_cls, new];
Expand Down

0 comments on commit fca42a0

Please sign in to comment.