Add List/Grid layout option for Home sections

Introduces a "Display sections as" picker in Home settings with List and
Grid modes. Grid renders each section as a horizontal shelf of video
cards, defaulting to Grid on tvOS and List on iOS/macOS. Per-platform
defaults are preserved via a platform-specific settings key.

On tvOS the shelf is a focus section so swiping up/down between rows of
different lengths works without getting stuck at the end of a row.
This commit is contained in:
Arkadiusz Fal
2026-04-15 17:54:18 +02:00
parent 758f4a678d
commit eb697b7bbc
8 changed files with 245 additions and 39 deletions

View File

@@ -30,6 +30,36 @@ enum HomeShortcutLayout: String, CaseIterable, Sendable {
}
}
// MARK: - Home Section Layout
/// Layout mode for the configurable home sections (Continue Watching, Feed, etc.).
enum HomeSectionLayout: String, CaseIterable, Sendable {
case list
case grid
var displayName: LocalizedStringKey {
switch self {
case .list: return "home.sections.layout.list"
case .grid: return "home.sections.layout.grid"
}
}
var systemImage: String {
switch self {
case .list: return "list.bullet"
case .grid: return "square.grid.2x2"
}
}
static var platformDefault: HomeSectionLayout {
#if os(tvOS)
return .grid
#else
return .list
#endif
}
}
// MARK: - Instance Content Type
/// Content type for instance home items.