wails/v3/pkg/application/webview_window_ios.h
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

56 lines
No EOL
2.1 KiB
Objective-C

//go:build ios
#ifndef WEBVIEW_WINDOW_IOS_H
#define WEBVIEW_WINDOW_IOS_H
#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>
#import "application_ios.h"
// Globals provided by application_ios.m
extern WailsAppDelegate *appDelegate;
extern unsigned int nextWindowID;
// Scheme handler bridging to Go asset server
@interface WailsSchemeHandler : NSObject <WKURLSchemeHandler>
@property (nonatomic, assign) unsigned int windowID;
- (instancetype)initWithWindowID:(unsigned int)windowID;
@end
// Script message handler bridging JS -> Go
@interface WailsMessageHandler : NSObject <WKScriptMessageHandler>
@property (nonatomic, assign) unsigned int windowID;
- (instancetype)initWithWindowID:(unsigned int)windowID;
@end
// Main view controller owning the WKWebView
@interface WailsViewController : UIViewController <WKNavigationDelegate, UITabBarDelegate>
@property (nonatomic, strong) WKWebView *webView;
@property (nonatomic, strong) WailsSchemeHandler *schemeHandler;
@property (nonatomic, strong) WailsMessageHandler *messageHandler;
@property (nonatomic, assign) unsigned int windowID;
- (void)enableNativeTabs:(BOOL)enabled;
- (void)selectNativeTabIndex:(NSInteger)index;
@property (nonatomic, strong) UITabBar *tabBar;
- (instancetype)initWithWindowID:(unsigned int)windowID;
- (void)executeJavaScript:(NSString *)js;
@end
// C-callable bridge used by Go
unsigned int ios_create_webview(void);
void* ios_create_webview_with_id(unsigned int wailsID);
void ios_execute_javascript(unsigned int windowID, const char* js);
void ios_window_exec_js(void* viewController, const char* js);
void ios_window_load_url(void* viewController, const char* url);
void ios_window_set_html(void* viewController, const char* html);
unsigned int ios_window_get_id(void* viewController);
void ios_window_release_handle(void* viewController);
// Console logging bridge (broadcast to all WKWebViews)
void ios_console_log(const char* level, const char* message);
// Set background color (RGBA 0-255) for a specific window's root view and webview
void ios_window_set_background_color(void* viewController, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
#endif /* WEBVIEW_WINDOW_IOS_H */