Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lolama (跨平台版)

桌面版 ~/Desktop/lolama 的跨平台移植,目标:iOS / iPadOS / macOS native / watchOS,UI 全部使用原生 SwiftUI。

当前状态

平台 状态 入口
iOS / iPadOS ✅ 编译通过 ContentView (Compact + Regular)
macOS native ✅ 编译通过 ContentView (Regular only)
visionOS ⚠️ 代码就绪,本机未装 SDK ContentView (Regular)
watchOS ⚠️ 代码就绪,需手工加 target WatchRootView

xcodebuild -destination 'platform=macOS'xcodebuild -destination 'generic/platform=iOS Simulator' 均通过。

跟桌面版的差异

  • LiteRT (Gemma 4 E2B) 端侧推理已用桩替代(Platform/LiteRTStub.swift),始终 notInstalled。原因:LiteRT C++ vendor 库无法跨 macOS / watchOS 编译。如需在 iOS 启用,把 Vendor/LiteRTLM-Swift 加回工程并删除 LiteRTStub.swift
  • Notifications + 后台定位 全部 #if os(iOS),只在 iPhone/iPad 编译。SettingsView 的"智能通知"入口也只在 iOS 显示。
  • HealthKit / CoreMotion 在 macOS 上自动跳过(返回空 EnvironmentSnapshot / ActivitySnapshot)。
  • AVAudioSession / 状态栏 / fullScreenCover / EditMode / .keyboardType / .textInputAutocapitalization / .toolbar(.hidden, for: .tabBar) 等 iOS-only API 全部加了 #if os(iOS) || os(visionOS) 守卫。
  • macOS 用 NavigationSplitViewStyle(.balanced),iOS regular 用 .prominentDetail

跨平台脚手架

  • Platform/PlatformShims.swift —— 跨平台 Color / Pasteboard / 触觉反馈 / Toolbar placement / 数字密码键盘 shim。
  • Platform/LiteRTStub.swift —— LiteRTLLMService / LiteRTModelManager 桩,与原 API 形状一致。
  • Platform/PreviewSupport.swift —— #Preview 用的样本数据(原本散在 ContentView 里)。
  • Platform/WatchRootView.swift —— watchOS 精简 UI。

加 watchOS target(需要在 Xcode 内手工操作)

watchOS 独立 app 需要单独的 bundle (WKApplication + watch 专用 Info.plist + entitlement),手工改 pbxproj 风险高,所以这一步留给 Xcode UI:

  1. 打开 lolama.xcodeproj
  2. File → New → Target → watchOSApp
  3. Product Name: lolama Watch,Bundle ID: com.qingyon.lolama.watchkitapp
  4. 把 watchOS 需要的源文件加入新 target 的 Membership(Inspector 右侧):
    • Platform/WatchRootView.swift
    • Platform/PlatformShims.swift
    • Platform/LiteRTStub.swift
    • RecordStore.swift,SwiftDataStorage.swift,L10n.swift,AppLogger.swift,AppLanguage.swift,KeychainStore.swift,AppLockStore.swift
    • Components/AppColors.swift,Components/HabitPresets.swift(只要 HabitVisual)
    • Localizable.xcstrings
  5. 在新 target 的入口文件里写:
    @main
    struct LolamaWatchApp: App {
        @StateObject private var store = RecordStore()
        @StateObject private var appLock = AppLockStore()
        var body: some Scene {
            WindowGroup {
                WatchRootView()
                    .environmentObject(store)
                    .environmentObject(appLock)
            }
        }
    }
  6. watch 上不需要的(Notifications、Chat、Settings、Stats 等)不加进 watch target,自动跳过。

watch UI 已经精简到三件事:记录速记 / 习惯列表 / 今日总数,跟你"watchOS 只具备必要功能"的要求一致。

跑 macOS 原生

xcodebuild -project lolama.xcodeproj -scheme lolama -destination 'platform=macOS' build

或在 Xcode 里把 destination 切到 "My Mac"。

已知细节

  • macOS 上 EnvironmentDataFetcher 不会真实采集步数 / 心率 / 气压(这些 API 不存在),只采集天气。
  • Mac Catalyst 没启用,目标是 macOS native binary。
  • 字符串目录 Localizable.xcstrings 直接复用桌面版,所有翻译保留。

About

一个帮助你自律的神奇APP。

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages