@@ -179,7 +179,7 @@ impl PlatformWebview {
179179 /// [WKWebView]: https://developer.apple.com/documentation/webkit/wkwebview
180180 #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
181181 #[ cfg_attr( docsrs, doc( cfg( any( target_os = "macos" , target_os = "ios" ) ) ) ) ]
182- pub fn inner ( & self ) -> cocoa :: base :: id {
182+ pub fn inner ( & self ) -> * mut std :: ffi :: c_void {
183183 self . 0 . webview
184184 }
185185
@@ -188,7 +188,7 @@ impl PlatformWebview {
188188 /// [controller]: https://developer.apple.com/documentation/webkit/wkusercontentcontroller
189189 #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
190190 #[ cfg_attr( docsrs, doc( cfg( any( target_os = "macos" , target_os = "ios" ) ) ) ) ]
191- pub fn controller ( & self ) -> cocoa :: base :: id {
191+ pub fn controller ( & self ) -> * mut std :: ffi :: c_void {
192192 self . 0 . manager
193193 }
194194
@@ -197,7 +197,7 @@ impl PlatformWebview {
197197 /// [NSWindow]: https://developer.apple.com/documentation/appkit/nswindow
198198 #[ cfg( target_os = "macos" ) ]
199199 #[ cfg_attr( docsrs, doc( cfg( target_os = "macos" ) ) ) ]
200- pub fn ns_window ( & self ) -> cocoa :: base :: id {
200+ pub fn ns_window ( & self ) -> * mut std :: ffi :: c_void {
201201 self . 0 . ns_window
202202 }
203203
@@ -206,7 +206,7 @@ impl PlatformWebview {
206206 /// [UIViewController]: https://developer.apple.com/documentation/uikit/uiviewcontroller
207207 #[ cfg( target_os = "ios" ) ]
208208 #[ cfg_attr( docsrs, doc( cfg( target_os = "ios" ) ) ) ]
209- pub fn view_controller ( & self ) -> cocoa :: base :: id {
209+ pub fn view_controller ( & self ) -> * mut std :: ffi :: c_void {
210210 self . 0 . view_controller
211211 }
212212
@@ -1000,9 +1000,6 @@ impl<R: Runtime> Webview<R> {
10001000 feature = "unstable" ,
10011001 doc = r####"
10021002```rust,no_run
1003- #[cfg(target_os = "macos")]
1004- #[macro_use]
1005- extern crate objc;
10061003use tauri::Manager;
10071004
10081005fn main() {
@@ -1026,10 +1023,14 @@ fn main() {
10261023
10271024 #[cfg(target_os = "macos")]
10281025 unsafe {
1029- let () = msg_send![webview.inner(), setPageZoom: 4.];
1030- let () = msg_send![webview.controller(), removeAllUserScripts];
1031- let bg_color: cocoa::base::id = msg_send![class!(NSColor), colorWithDeviceRed:0.5 green:0.2 blue:0.4 alpha:1.];
1032- let () = msg_send![webview.ns_window(), setBackgroundColor: bg_color];
1026+ let view: &objc2_web_kit::WKWebView = &*webview.inner().cast();
1027+ let controller: &objc2_web_kit::WKUserContentController = &*webview.controller().cast();
1028+ let window: &objc2_app_kit::NSWindow = &*webview.ns_window().cast();
1029+
1030+ view.setPageZoom(4.);
1031+ controller.removeAllUserScripts();
1032+ let bg_color = objc2_app_kit::NSColor::colorWithDeviceRed_green_blue_alpha(0.5, 0.2, 0.4, 1.);
1033+ window.setBackgroundColor(Some(&bg_color));
10331034 }
10341035
10351036 #[cfg(target_os = "android")]
0 commit comments