mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-15 23:25:49 +01:00
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>
56 lines
1.3 KiB
Go
56 lines
1.3 KiB
Go
//go:build darwin && !ios
|
|
|
|
package application
|
|
|
|
/*
|
|
#cgo CFLAGS: -mmacosx-version-min=10.13 -x objective-c
|
|
#cgo LDFLAGS: -framework Cocoa -mmacosx-version-min=10.13
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
#import <stdlib.h>
|
|
|
|
bool setClipboardText(const char* text) {
|
|
NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard];
|
|
NSError *error = nil;
|
|
NSString *string = [NSString stringWithUTF8String:text];
|
|
[pasteBoard clearContents];
|
|
return [pasteBoard setString:string forType:NSPasteboardTypeString];
|
|
}
|
|
|
|
const char* getClipboardText() {
|
|
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
|
NSString *text = [pasteboard stringForType:NSPasteboardTypeString];
|
|
return [text UTF8String];
|
|
}
|
|
|
|
*/
|
|
import "C"
|
|
import (
|
|
"sync"
|
|
"unsafe"
|
|
)
|
|
|
|
var clipboardLock sync.RWMutex
|
|
|
|
type macosClipboard struct{}
|
|
|
|
func (m macosClipboard) setText(text string) bool {
|
|
clipboardLock.Lock()
|
|
defer clipboardLock.Unlock()
|
|
cText := C.CString(text)
|
|
success := C.setClipboardText(cText)
|
|
C.free(unsafe.Pointer(cText))
|
|
return bool(success)
|
|
}
|
|
|
|
func (m macosClipboard) text() (string, bool) {
|
|
clipboardLock.RLock()
|
|
defer clipboardLock.RUnlock()
|
|
clipboardText := C.getClipboardText()
|
|
result := C.GoString(clipboardText)
|
|
return result, true
|
|
}
|
|
|
|
func newClipboardImpl() *macosClipboard {
|
|
return &macosClipboard{}
|
|
}
|