yattee/Shared/EnvironmentValues.swift

36 lines
841 B
Swift
Raw Normal View History

import Foundation
import SwiftUI
private struct InNavigationViewKey: EnvironmentKey {
static let defaultValue = false
}
2021-09-18 20:36:42 +00:00
private struct HorizontalCellsKey: EnvironmentKey {
static let defaultValue = false
}
2021-09-19 12:42:47 +00:00
enum NavigationStyle {
case tab, sidebar
}
private struct NavigationStyleKey: EnvironmentKey {
static let defaultValue = NavigationStyle.tab
}
extension EnvironmentValues {
var inNavigationView: Bool {
get { self[InNavigationViewKey.self] }
set { self[InNavigationViewKey.self] = newValue }
}
2021-09-18 20:36:42 +00:00
var horizontalCells: Bool {
get { self[HorizontalCellsKey.self] }
set { self[HorizontalCellsKey.self] = newValue }
}
2021-09-19 12:42:47 +00:00
var navigationStyle: NavigationStyle {
get { self[NavigationStyleKey.self] }
set { self[NavigationStyleKey.self] = newValue }
}
}