mirror of
https://github.com/yattee/yattee.git
synced 2025-10-18 05:18:12 +00:00
Listing styles
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import Defaults
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
@@ -21,6 +22,24 @@ private struct NavigationStyleKey: EnvironmentKey {
|
||||
static let defaultValue = NavigationStyle.tab
|
||||
}
|
||||
|
||||
private struct ListingStyleKey: EnvironmentKey {
|
||||
static let defaultValue = ListingStyle.cells
|
||||
}
|
||||
|
||||
enum ListingStyle: String, CaseIterable, Defaults.Serializable {
|
||||
case cells
|
||||
case list
|
||||
|
||||
var systemImage: String {
|
||||
switch self {
|
||||
case .cells:
|
||||
return "rectangle.grid.2x2"
|
||||
case .list:
|
||||
return "list.dash"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct CurrentPlaylistID: EnvironmentKey {
|
||||
static let defaultValue: String? = nil
|
||||
}
|
||||
@@ -70,4 +89,9 @@ extension EnvironmentValues {
|
||||
get { self[ScrollViewBottomPaddingKey.self] }
|
||||
set { self[ScrollViewBottomPaddingKey.self] = newValue }
|
||||
}
|
||||
|
||||
var listingStyle: ListingStyle {
|
||||
get { self[ListingStyleKey.self] }
|
||||
set { self[ListingStyleKey.self] = newValue }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user