VoiceStudio is the open-source, fully-local ElevenLabs alternative — voice cloning, voice design, video dubbing, dictation, transcription & audiobook creation in 646 languages.
Python aiaudiobookcudadubbingelevenlabs-alternativehuggingfacelocal-firstmlxomnivoice-studiospeech-to-texttext-to-speechtranscriptiontranslatettsvoice-aivoice-cloningvoice-generationvoicestudioworkflow
feat(ios): live Xcode previews on the offline mock host
debpalashbf03a6cfbdbf
diff --git a/mobile/ios/README.md b/mobile/ios/README.mdindex c9fe71ba0..f55b3490c 100644--- a/mobile/ios/README.md+++ b/mobile/ios/README.md@@ -186,3 +186,10 @@ profile in the browser. Dub is one big source card with an animated vector mark(`DubGlyph`, static under Reduce Motion), language and voice tiles, a consent row and livejob cards. The bottom dock is icon-only; tab names remain accessibility labels.+## Live previews++`App/Previews.swift` (debug builds only) adds Xcode canvas previews for Home, Dub (dark, light and large+text), Models, the licence sheet and the dub glyph. They run the same offline mock host as the UI tests+(`AppModel(mock: true)`), so screens render with realistic data and update as you edit. Open a view file+and press Option-Command-Return; Run (Command-R) is still a full rebuild.+diff --git a/mobile/ios/VoiceStudio/App/AppModel.swift b/mobile/ios/VoiceStudio/App/AppModel.swiftindex 9062d370a..ea4edca91 100644--- a/mobile/ios/VoiceStudio/App/AppModel.swift+++ b/mobile/ios/VoiceStudio/App/AppModel.swift@@ -27,10 +27,11 @@ import BackgroundTasksprivate(set) var monitorTask: Task<Void, Never>?private var notified = Set<String>()private var monitorID = UUID()- init() {+ /// `mock` runs the offline smoke host (debug builds only), for SwiftUI previews.+ init(mock: Bool = false) {let d = UserDefaults.standard#if DEBUG- let mockMode = ProcessInfo.processInfo.arguments.contains("--ui-smoke")+ let mockMode = mock || ProcessInfo.processInfo.arguments.contains("--ui-smoke")if mockMode {for task in ["speak", "dictate", "clone", "dub"] { d.removeObject(forKey: "run-on."+task) }d.removeObject(forKey: "consentAnswered"); d.removeObject(forKey: "activeHost")diff --git a/mobile/ios/VoiceStudio/App/Previews.swift b/mobile/ios/VoiceStudio/App/Previews.swiftnew file mode 100644index 000000000..d1b439882--- /dev/null+++ b/mobile/ios/VoiceStudio/App/Previews.swift@@ -0,0 +1,37 @@+#if DEBUG+import SwiftUI+import VoiceStudioKit++/// Live previews (Xcode canvas) run the same offline mock host as the UI tests, so+/// screens render with realistic data and update as the file is edited.+private struct PreviewHost<Content: View>: View {+ @State private var model = AppModel(mock: true)+ @Environment(\.colorScheme) private var scheme+ let content: Content+ init(@ViewBuilder content: () -> Content) { self.content = content() }+ var body: some View {+ let theme = Theme(palette: model.theme.palette(system: scheme == .dark ? .dark : .light), appearance: model.theme.appearance(system: scheme == .dark ? .dark : .light))+ NavigationStack { content }+ .environment(model).environment(\.vsTheme, theme)+ .textFieldStyle(VSFieldStyle()).tint(theme.color("messageAction"))+ .foregroundStyle(theme.color("text")).background(theme.color("canvas"))+ .task { NativeTheme.apply(theme); await model.phone.refresh() }+ }+}+private struct LicencePreview: View {+ @Environment(AppModel.self) private var model+ var body: some View {+ if let item = model.phone.models.first { ModelLicenceSheet(item: item) } else { ProgressView() }+ }+}++#Preview("Home") { PreviewHost { HomeView() }.preferredColorScheme(.dark) }+#Preview("Dub") { PreviewHost { DubView() }.preferredColorScheme(.dark) }+#Preview("Dub, large text") { PreviewHost { DubView() }.preferredColorScheme(.dark).environment(\.dynamicTypeSize, .accessibility2) }+#Preview("Dub, light") { PreviewHost { DubView() }.preferredColorScheme(.light) }+#Preview("Models") { PreviewHost { ModelsView() }.preferredColorScheme(.dark) }+#Preview("Licence") { PreviewHost { LicencePreview() }.preferredColorScheme(.dark) }+#Preview("Dub glyph") {+ PreviewHost { VStack(spacing: 24) { DubGlyph(size: 96); DubGlyph(size: 48, active: true) } }.preferredColorScheme(.dark)+}+#endif