Add 'osx/' from commit '46755a07ef2e7aa9852d74c30e2c12f9fe8f2278'
git-subtree-dir: osx git-subtree-mainline:034026e88agit-subtree-split:46755a07ef
This commit is contained in:
38
osx/kordophone2/SplitView.swift
Normal file
38
osx/kordophone2/SplitView.swift
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// SplitView.swift
|
||||
// kordophone2
|
||||
//
|
||||
// Created by James Magahern on 8/29/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SplitView: View
|
||||
{
|
||||
@State var conversationListModel = ConversationListView.ViewModel()
|
||||
@State var transcriptViewModel = TranscriptView.ViewModel()
|
||||
@State var entryViewModel = MessageEntryView.ViewModel()
|
||||
|
||||
private let xpcClient = XPCClient()
|
||||
private var selectedConversation: Display.Conversation? {
|
||||
guard let id = conversationListModel.selectedConversations.first else { return nil }
|
||||
return conversationListModel.conversations.first { $0.id == id }
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationSplitView {
|
||||
ConversationListView(model: $conversationListModel)
|
||||
.frame(minWidth: 330.0)
|
||||
.xpcClient(xpcClient)
|
||||
} detail: {
|
||||
ConversationView(transcriptModel: $transcriptViewModel, entryModel: $entryViewModel)
|
||||
.xpcClient(xpcClient)
|
||||
.selectedConversation(selectedConversation)
|
||||
.navigationTitle("Kordophone")
|
||||
.navigationSubtitle(selectedConversation?.displayName ?? "")
|
||||
.onChange(of: conversationListModel.selectedConversations) { oldValue, newValue in
|
||||
transcriptViewModel.displayedConversation = conversationListModel.conversations.first { $0.id == newValue.first }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user