Fix new splitview layout on iPad

This commit is contained in:
Jackson Harper 2023-07-10 10:37:42 +08:00
parent b099d22115
commit e7861b0747
4 changed files with 65 additions and 5 deletions

View file

@ -35,11 +35,10 @@ enum PrimaryContentCategory: Identifiable, Hashable, Equatable {
Label { Text(title) } icon: { image.renderingMode(.template) }
}
@ViewBuilder var destinationView: some View {
@MainActor @ViewBuilder var destinationView: some View {
switch self {
case .feed:
// HomeView(viewModel: HomeFeedViewModel())
EmptyView()
LibraryListView()
case .profile:
ProfileView()
}

View file

@ -0,0 +1,60 @@
//
// File.swift
//
//
// Created by Jackson Harper on 6/29/23.
//
import Foundation
import Models
import SwiftUI
struct LibraryListView: View {
@StateObject private var subViewModel = HomeFeedViewModel(
listConfig: LibraryListConfig(
hasFeatureCards: false,
leadingSwipeActions: [.moveToInbox],
trailingSwipeActions: [.delete, .archive],
cardStyle: .library
)
)
@StateObject private var libraryViewModel = HomeFeedViewModel(
listConfig: LibraryListConfig(
hasFeatureCards: true,
leadingSwipeActions: [.pin],
trailingSwipeActions: [.delete, .archive],
cardStyle: .library
)
)
@StateObject private var highlightsViewModel = HomeFeedViewModel(
listConfig: LibraryListConfig(
hasFeatureCards: true,
leadingSwipeActions: [.pin],
trailingSwipeActions: [.delete, .archive],
cardStyle: .highlights
)
)
var body: some View {
ZStack {
NavigationLink(
destination: LinkDestination(selectedItem: libraryViewModel.selectedItem),
isActive: $libraryViewModel.linkIsActive
) {
EmptyView()
}
HomeView(viewModel: libraryViewModel)
.tabItem {
Label {
Text("Library")
} icon: {
Image.tabLibrary
}
}
}
.navigationViewStyle(.stack)
.navigationBarTitleDisplayMode(.inline)
}
}

View file

@ -75,5 +75,6 @@ struct LibraryTabView: View {
}
}
.navigationViewStyle(.stack)
.navigationBarTitleDisplayMode(.inline)
}
}

View file

@ -3,7 +3,7 @@ import Services
import SwiftUI
import Views
public struct PrimaryContentView: View {
@MainActor public struct PrimaryContentView: View {
let categories = [
PrimaryContentCategory.feed,
PrimaryContentCategory.profile
@ -52,7 +52,7 @@ public struct PrimaryContentView: View {
#endif
}
struct PrimaryContentSidebar: View {
@MainActor struct PrimaryContentSidebar: View {
@State private var selectedCategory: PrimaryContentCategory?
let categories: [PrimaryContentCategory]