Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Onedict macOS

The native macOS shell (SwiftUI + AppKit) over the Rust onedict-core.

macos/
├── OnedictCore/                  # the Rust↔Swift bridge
│   ├── build-xcframework.sh      # universal XCFramework + Swift bindings
│   ├── generated/                # UniFFI output (onedict_core.swift, .h, .modulemap)
│   ├── OnedictCore.xcframework/   # built artifact the app links (git-ignored in CI)
│   └── smoke/main.swift          # Swift→Rust end-to-end smoke test
└── Onedict/                      # the SwiftUI app (SwiftPM)
    ├── project.yml               # XcodeGen spec → Onedict.xcodeproj
    ├── build-app.sh              # one-shot: xcframework + project + .app
    ├── Package.swift             # SwiftPM (fast `swift build` for compile checks)
    └── Sources/Onedict/
        ├── OnedictApp.swift          # @main, window (hiddenTitleBar, 1120×680)
        ├── AppState.swift            # observable state; debounced search; off-main calls
        ├── Engine.swift              # wrapper over the UniFFI OnedictEngine
        ├── DesignTokens.swift        # §4.1 colors / §4.2 typography
        ├── ContentView.swift         # 280pt two-column layout, empty/not-found states
        ├── SearchField.swift         # fused title-bar search (↑↓/↩/Esc/⌘F)
        ├── EntryWebView.swift        # WKWebView + onedict:// scheme handler
        ├── DictionaryManagerView.swift  # F1: enable / reorder / delete / add
        └── Generated/onedict_core.swift # UniFFI bindings (copied from OnedictCore/generated)

Build

# One shot: build the XCFramework, generate the Xcode project, build the .app
cd macos/Onedict && ./build-app.sh
open .build/xcode/Build/Products/Debug/Onedict.app

# Fast compile-check loop (no app bundle):
swift build

Requires xcodegen (brew install xcodegen). The Xcode project is generated from Onedict/project.yml — edit that, not the .xcodeproj. The only build warnings are benign macOS deployment-target notes from Rust's prebuilt std (built against a newer SDK than the app's minimum). M4 swaps the ad-hoc signing for a Developer ID identity + notarization.

Status

M2 UI — see ../DELIVERY.md for the full milestone map. Built, bundled, and launch-verified. Wired to the core: drag-and-drop + panel import, incremental suggestion (↑↓/↩/30ms debounce), aggregated WKWebView rendering with Shadow-DOM isolation, neighbor-word "翻词典" pane, ⌘⇧L collapse, capsule anchor bar + ⌘1-9 jump, ⌘[ /⌘] navigation, ⌘S favorites + favorites/history pages, dictionary management, light/dark re-skin, three font sizes. Pending polish: pixel-level §4 alignment, welcome page, current-section highlight; and the M3 features (global 划词 + HUD, pronunciation, wiki section).