1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 13:50:32 +05:30
yattee/Shared/EnvironmentValues.swift

74 lines
1.9 KiB
Swift
Raw Normal View History

import Foundation
import SwiftUI
private struct InNavigationViewKey: EnvironmentKey {
static let defaultValue = false
}
2021-10-28 22:44:55 +05:30
private struct InChannelViewKey: EnvironmentKey {
static let defaultValue = false
}
private struct InChannelPlaylistViewKey: EnvironmentKey {
static let defaultValue = false
}
2021-09-19 02:06:42 +05:30
private struct HorizontalCellsKey: EnvironmentKey {
static let defaultValue = false
}
2021-09-19 18:12:47 +05:30
enum NavigationStyle {
case tab, sidebar
}
private struct NavigationStyleKey: EnvironmentKey {
static let defaultValue = NavigationStyle.tab
}
2021-10-25 03:06:24 +05:30
private struct CurrentPlaylistID: EnvironmentKey {
static let defaultValue: String? = nil
}
private struct LoadMoreContentHandler: EnvironmentKey {
2022-01-09 20:35:05 +05:30
static let defaultValue: LoadMoreContentHandlerType = {}
}
2022-01-09 20:17:24 +05:30
typealias LoadMoreContentHandlerType = () -> Void
extension EnvironmentValues {
var inNavigationView: Bool {
get { self[InNavigationViewKey.self] }
set { self[InNavigationViewKey.self] = newValue }
}
2021-09-19 02:06:42 +05:30
2021-10-28 22:44:55 +05:30
var inChannelView: Bool {
get { self[InChannelViewKey.self] }
set { self[InChannelViewKey.self] = newValue }
}
var inChannelPlaylistView: Bool {
get { self[InChannelPlaylistViewKey.self] }
set { self[InChannelPlaylistViewKey.self] = newValue }
}
2021-09-19 02:06:42 +05:30
var horizontalCells: Bool {
get { self[HorizontalCellsKey.self] }
set { self[HorizontalCellsKey.self] = newValue }
}
2021-09-19 18:12:47 +05:30
var navigationStyle: NavigationStyle {
get { self[NavigationStyleKey.self] }
set { self[NavigationStyleKey.self] = newValue }
}
2021-10-25 03:06:24 +05:30
var currentPlaylistID: String? {
get { self[CurrentPlaylistID.self] }
set { self[CurrentPlaylistID.self] = newValue }
}
2022-01-09 20:17:24 +05:30
var loadMoreContentHandler: LoadMoreContentHandlerType {
get { self[LoadMoreContentHandler.self] }
set { self[LoadMoreContentHandler.self] = newValue }
}
}