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

65 lines
1.9 KiB
Go

//go:build ios
package application
/*
#cgo CFLAGS: -x objective-c -fmodules -fobjc-arc
#cgo LDFLAGS: -framework UIKit
#include <stdlib.h>
#include "application_ios.h"
*/
import "C"
import (
"encoding/json"
"unsafe"
)
func iosHapticsImpact(style string) {
cstr := C.CString(style)
defer C.free(unsafe.Pointer(cstr))
C.ios_haptics_impact(cstr)
}
type deviceInfo struct {
Model string `json:"model"`
SystemName string `json:"systemName"`
SystemVersion string `json:"systemVersion"`
IsSimulator bool `json:"isSimulator"`
}
func iosDeviceInfo() deviceInfo {
ptr := C.ios_device_info_json()
if ptr == nil {
return deviceInfo{}
}
defer C.free(unsafe.Pointer(ptr))
goStr := C.GoString(ptr)
var out deviceInfo
_ = json.Unmarshal([]byte(goStr), &out)
return out
}
// Live mutations
func iosSetScrollEnabled(enabled bool) { C.ios_runtime_set_scroll_enabled(C.bool(enabled)) }
func iosSetBounceEnabled(enabled bool) { C.ios_runtime_set_bounce_enabled(C.bool(enabled)) }
func iosSetScrollIndicatorsEnabled(enabled bool) {
C.ios_runtime_set_scroll_indicators_enabled(C.bool(enabled))
}
func iosSetBackForwardGesturesEnabled(enabled bool) {
C.ios_runtime_set_back_forward_gestures_enabled(C.bool(enabled))
}
func iosSetLinkPreviewEnabled(enabled bool) { C.ios_runtime_set_link_preview_enabled(C.bool(enabled)) }
func iosSetInspectableEnabled(enabled bool) { C.ios_runtime_set_inspectable_enabled(C.bool(enabled)) }
func iosSetCustomUserAgent(ua string) {
var cstr *C.char
if ua != "" {
cstr = C.CString(ua)
defer C.free(unsafe.Pointer(cstr))
}
C.ios_runtime_set_custom_user_agent(cstr)
}
// Native tabs
func iosSetNativeTabsEnabled(enabled bool) { C.ios_native_tabs_set_enabled(C.bool(enabled)) }
func iosNativeTabsIsEnabled() bool { return bool(C.ios_native_tabs_is_enabled()) }
func iosSelectNativeTab(index int) { C.ios_native_tabs_select_index(C.int(index)) }