ce55be4a-fb5f-4981-b507-0f4.../README.md
徐翔宇 c4080b5cb9 v1.0.0: initial AirDrop plugin for MioIsland
Quick-access AirDrop from the notch panel. Tap the card body, pick
files via NSOpenPanel, hand off to NSSharingService(.sendViaAirDrop).
No private APIs, no entitlements, no network — just a thin wrapper
around the same AirDrop API Finder uses.

Design constraint: drag-and-drop is intentionally not implemented.
MioIsland's notch panel auto-collapses on click-outside, which
breaks the Cmd-Tab-to-Finder / grab / drag-back workflow before
the drop target reaches. Tap-to-choose is rock solid by comparison.

Requires MioIsland host v2.2.0+ (panel size clamp floor was
lowered to 120pt in that release).
2026-04-22 08:20:47 +08:00

67 lines
2.1 KiB
Markdown

# AirDrop Plugin for MioIsland
Quick access to macOS AirDrop from your Mio Island panel. Tap the
center of the card to pick files, then the system AirDrop sheet
appears and lets you send to nearby devices or contacts.
[简体中文](README.zh-CN.md)
## Features
- **One-tap file picker** — opens the native `NSOpenPanel`, supports
multi-select and folders.
- **Native AirDrop sheet** — uses `NSSharingService(.sendViaAirDrop)`,
the same API Finder uses. No private APIs, no entitlements.
- **Bi-lingual UI** — follows MioIsland's `appLanguage` preference
(`zh` / `en`).
- **Zero permissions required** — no Accessibility, no Automation, no
network. The plugin just delegates to macOS' built-in AirDrop.
## Why no drag-and-drop?
Mio Island's notch panel auto-collapses when the user clicks outside
it — that means the natural "open Island → Cmd-Tab to Finder → grab
file → drag back" workflow can't work, the panel disappears before
the drop target reaches. Rather than fight the host's event routing
(we tried, it broke in three different ways), this plugin commits
to a rock-solid **tap-to-choose** UX.
If you want drag-based sharing, stay tuned — a future Mio Island
host release may add a global drag-to-open trigger (similar to
Atoll's Dynamic Island drop zone).
## Requirements
- macOS 15.0+
- Mio Island v2.2.0+
## Building from source
```bash
./build.sh
```
Produces `build/airdrop.bundle` and `build/airdrop.zip`. Drop the
bundle into `~/.config/codeisland/plugins/` to test locally.
## Structure
```
Sources/
├── MioPlugin.swift ← protocol copy (runtime-matched via @objc)
├── AirDropPlugin.swift ← principal class, Info.plist NSPrincipalClass
├── AirDropState.swift ← @MainActor ObservableObject phase machine
├── services/
│ └── AirDropService.swift ← thin wrapper around NSSharingService
├── ui/
│ ├── ExpandedView.swift ← card-in-container layout
│ └── DropZoneView.swift ← tap-target, phase-reactive visuals
└── support/
├── Localization.swift
└── HostVersionCheck.swift
```
## License
MIT — see [LICENSE](LICENSE).