mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
split ios and mac implementations of primary layout
This commit is contained in:
parent
c1e9bbe690
commit
2f0158de8d
2 changed files with 34 additions and 20 deletions
|
|
@ -186,6 +186,7 @@ struct LinkItemDetailView: View {
|
|||
}
|
||||
}
|
||||
|
||||
@available(macOS 12.0, *)
|
||||
@available(iOS 15.0, *)
|
||||
var navBar: some View {
|
||||
HStack(alignment: .center) {
|
||||
|
|
|
|||
|
|
@ -4,40 +4,53 @@ import SwiftUI
|
|||
import Views
|
||||
|
||||
public struct PrimaryContentView: View {
|
||||
let categories = [
|
||||
PrimaryContentCategory.feed,
|
||||
PrimaryContentCategory.profile
|
||||
]
|
||||
|
||||
public var body: some View {
|
||||
#if os(iOS)
|
||||
if UIDevice.isIPad {
|
||||
regularView
|
||||
splitView
|
||||
} else {
|
||||
HomeView()
|
||||
}
|
||||
#elseif os(macOS)
|
||||
regularView
|
||||
splitView
|
||||
#endif
|
||||
}
|
||||
|
||||
// ipad and mac view container
|
||||
private var regularView: some View {
|
||||
let categories = [
|
||||
PrimaryContentCategory.feed,
|
||||
PrimaryContentCategory.profile
|
||||
]
|
||||
#if os(macOS)
|
||||
private var splitView: some View {
|
||||
NavigationView {
|
||||
// The first column is the sidebar.
|
||||
PrimaryContentSidebar(categories: categories)
|
||||
.navigationTitle("Categories")
|
||||
|
||||
return NavigationView {
|
||||
// The first column is the sidebar.
|
||||
PrimaryContentSidebar(categories: categories)
|
||||
.navigationTitle("Categories")
|
||||
// Second column is the Primary Nav Stack
|
||||
PrimaryContentCategory.feed.destinationView
|
||||
|
||||
// Second column is the Primary Nav Stack
|
||||
PrimaryContentCategory.feed.destinationView
|
||||
|
||||
// Add a third column for macOS only
|
||||
#if os(macOS)
|
||||
// Third column is the detail view
|
||||
Text("Select a link from the feed")
|
||||
#endif
|
||||
}
|
||||
.accentColor(.appGrayTextContrast)
|
||||
}
|
||||
.accentColor(.appGrayTextContrast)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if os(iOS)
|
||||
private var splitView: some View {
|
||||
NavigationView {
|
||||
// The first column is the sidebar.
|
||||
PrimaryContentSidebar(categories: categories)
|
||||
.navigationTitle("Categories")
|
||||
|
||||
// Second column is the Primary Nav Stack
|
||||
PrimaryContentCategory.feed.destinationView
|
||||
}
|
||||
.accentColor(.appGrayTextContrast)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
struct PrimaryContentSidebar: View {
|
||||
|
|
|
|||
Loading…
Reference in a new issue