Full SwiftUI app at clients/apple/iOS/VoiceCatiOS.xcodeproj:
- 24 Swift source files: AppState + SessionState (@Observable @MainActor),
AudioSessionManager (AVAudioSession owner + interruption/route handling),
ServerListStore/SavedServer (App Group container + Keychain sharing),
and 14 SwiftUI views covering the full feature set
- NavigationSplitView on iPad, TabView on iPhone (horizontalSizeClass)
- Channel tree via OutlineGroup, user list with context menu admin actions
- PTT via DragGesture(minimumDistance: 0) + @GestureState
- onEvent closures hop to MainActor via Task { @MainActor in ... }
- App Group: group.cat.voice.VoiceCat (shared with future ReplayKit extension)
C ABI: add vc_audio_suspend / vc_audio_resume (AudioEngine::suspend/resume)
called by AudioSessionManager on AVAudioSession interruption events.
XCFramework: add ios-arm64 and ios-arm64-simulator slices to build-xcframework.sh;
Package.swift gains .iOS(.v17) platform; CMakePresets.json adds apple-ios /
apple-ios-sim presets with arm64-ios / arm64-ios-simulator vcpkg triplets.
Verified: xcodebuild -target VoiceCatiOS -sdk iphonesimulator26.5 BUILD SUCCEEDED.
61 lines
2.8 KiB
Swift
61 lines
2.8 KiB
Swift
// swift-tools-version: 5.9
|
|
//
|
|
// VoiceCatCore — the shared Swift core for the VoiceCat macOS (AppKit) and iOS (SwiftUI)
|
|
// clients. It wraps libvoicecat's C ABI (core/include/voicecat.h) as imported through the
|
|
// VoiceCatCore.xcframework binary target's module map (`import VoiceCatC`), and exposes a
|
|
// Swift-idiomatic, @MainActor-safe surface.
|
|
//
|
|
// Architecture: docs/architecture.md §4 ("one core, many faces"). The Windows C# client
|
|
// (clients/windows/VoiceCat.Interop) is the proven mirror of this same layering — the Swift
|
|
// wrapper follows the same patterns (callback-lifetime, string-lifetime, event-delivery
|
|
// thread handoff, immediate vc_free_* on list reads) adapted to Swift's interop model.
|
|
//
|
|
// The XCFramework is a LOCAL BUILD ARTIFACT — run `scripts/build-xcframework.sh` before
|
|
// `swift build` / `swift test`. See clients/apple/README.md.
|
|
import PackageDescription
|
|
|
|
let package = Package(
|
|
name: "VoiceCatCore",
|
|
// macOS 14 (Sonoma) is the AppKit client's deployment target. iOS 17 is the SwiftUI client
|
|
// target (clients/apple/iOS/). Run `scripts/build-xcframework.sh --all` to produce all
|
|
// three slices: macos-arm64, ios-arm64, ios-arm64-simulator.
|
|
platforms: [
|
|
.macOS(.v14),
|
|
.iOS(.v17),
|
|
],
|
|
products: [
|
|
.library(name: "VoiceCatCore", targets: ["VoiceCatCore"]),
|
|
],
|
|
targets: [
|
|
// Binary target — the prebuilt static lib + headers + module map. Produced by
|
|
// scripts/build-xcframework.sh from the `apple-dev` CMake preset.
|
|
.binaryTarget(
|
|
name: "VoiceCatCoreXCF",
|
|
path: "VoiceCatCore.xcframework"
|
|
),
|
|
// The Swift wrapper library — what the macOS/iOS apps import as `import VoiceCatCore`.
|
|
.target(
|
|
name: "VoiceCatCore",
|
|
dependencies: ["VoiceCatCoreXCF"],
|
|
path: "Sources/VoiceCatCore"
|
|
),
|
|
// Smoke tests against a real voicecat-server — mirrors clients/windows/
|
|
// VoiceCat.Interop.Tests/VoiceCatClientSmokeTests.cs. Requires the `dev` CMake preset
|
|
// to be built (build/dev/bin/voicecat-server + voicecat-admin).
|
|
//
|
|
// linkerSettings: libvoicecat.a is a static C++20 library (built by the apple-dev
|
|
// preset with vcpkg's clang), so the final executable must link libc++ (the LLVM C++
|
|
// standard library on macOS). vcpkg's static deps (mbedtls/sodium/opus/protobuf/
|
|
// sqlite3/spdlog/asio) are already compiled into the .a; macOS system frameworks
|
|
// (CoreAudio/CoreFoundation) are auto-discovered by the linker (PROGRESS.md).
|
|
.testTarget(
|
|
name: "VoiceCatCoreTests",
|
|
dependencies: ["VoiceCatCore"],
|
|
path: "Tests/VoiceCatCoreTests",
|
|
linkerSettings: [
|
|
.linkedLibrary("c++"),
|
|
]
|
|
),
|
|
]
|
|
)
|