wails/v3/pkg/application/webview_window_darwin_dev.go
Lea Anthony 873848a077 Merge iOS support from v3-alpha-feature/ios-support
This commit integrates iOS platform support for Wails v3, adapting the
iOS-specific code to work with the new transport layer architecture.

Key changes:
- Add iOS-specific application, webview, and runtime files
- Add iOS event types and processing
- Add iOS examples and templates
- Update messageprocessor to handle iOS requests
- Move badge_ios.go to dock package

Note: The iOS branch was based on an older v3-alpha and required
significant conflict resolution due to the transport layer refactor
(PR #4702). Some iOS-specific code may need further adaptation:
- processIOSMethod needs to be implemented with new RuntimeRequest signature
- iOS event generation in tasks/events/generate.go needs updating

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-10 18:34:21 +11:00

57 lines
1.2 KiB
Go

//go:build darwin && !ios && (!production || devtools)
package application
/*
#cgo CFLAGS: -mmacosx-version-min=10.13 -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
#include "webview_window_darwin.h"
@interface _WKInspector : NSObject
- (void)show;
- (void)detach;
@end
@interface WKWebView ()
- (_WKInspector *)_inspector;
@end
void openDevTools(void *window) {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
if (@available(macOS 12.0, *)) {
dispatch_async(dispatch_get_main_queue(), ^{
WebviewWindow* nsWindow = (WebviewWindow*)window;
@try {
[nsWindow.webView._inspector show];
} @catch (NSException *exception) {
NSLog(@"Opening the inspector failed: %@", exception.reason);
return;
}
});
}
#else
NSLog(@"Opening the inspector needs at least MacOS 12");
#endif
}
// Enable NSWindow devtools
void windowEnableDevTools(void* nsWindow) {
WebviewWindow* window = (WebviewWindow*)nsWindow;
// Enable devtools in webview
[window.webView.configuration.preferences setValue:@YES forKey:@"developerExtrasEnabled"];
}
*/
import "C"
func (w *macosWebviewWindow) openDevTools() {
C.openDevTools(w.nsWindow)
}
func (w *macosWebviewWindow) enableDevTools() {
C.windowEnableDevTools(w.nsWindow)
}