Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

iOS shell: centred Cover Flow block, edge-to-edge settings header

v0lumehi6e5428601784
diff --git a/frontend-ios/Sources/ShellUI/CoverFlowView.swift b/frontend-ios/Sources/ShellUI/CoverFlowView.swift
index e7c232a6..b0268671 100644
--- a/frontend-ios/Sources/ShellUI/CoverFlowView.swift
+++ b/frontend-ios/Sources/ShellUI/CoverFlowView.swift
@@ -38,19 +38,26 @@ struct CoverFlowView: View, Equatable {
let short = geometry.size.height < 520
// A wide card as large as the Mac console's focused tile: what the height allows, never so wide that the
// neighbours vanish.
- let cardHeight = max(90, min(geometry.size.height * (short ? 0.5 : 0.46), geometry.size.width * 0.54 * 9 / 16))
+ let cardHeight = max(90, min(geometry.size.height * (short ? 0.42 : 0.44), geometry.size.width * 0.54 * 9 / 16))
let cover = cardHeight * 16 / 9
VStack(spacing: 0) {
topBar.padding(.horizontal, 24).padding(.top, short ? 4 : 16)
- Spacer(minLength: short ? 4 : 12)
- Group {
- if games.count <= 3 { shelf(width: geometry.size.width, cover: cover) } else { carousel(width: geometry.size.width, cover: cover) }
- }.frame(height: cover * 9 / 16 * 1.06)
- info(short: short, width: geometry.size.width)
- .padding(.top, short ? 12 : 26).padding(.horizontal, 24)
- Spacer(minLength: short ? 4 : 12)
- // The hint row keeps its place when it is hidden, so the card does not move when it appears.
- hints.opacity(showsHints ? 1 : 0).padding(.bottom, short ? 6 : 20)
+ // The cover block (cards, title and state, the hint row) is centred in the space under the top bar, a
+ // touch above the middle, never closer to the bar than the minimum gap. Its parts keep fixed places
+ // inside it, so nothing moves between games.
+ Spacer(minLength: short ? 18 : 32)
+ VStack(spacing: 0) {
+ Group {
+ if games.count <= 3 { shelf(width: geometry.size.width, cover: cover) } else { carousel(width: geometry.size.width, cover: cover) }
+ }.frame(height: cover * 9 / 16 * 1.06)
+ info(short: short, width: geometry.size.width)
+ .padding(.top, short ? 12 : 26).padding(.horizontal, 24)
+ // The hint row keeps its place when it is hidden, so the card does not move when it appears.
+ hints.opacity(showsHints ? 1 : 0).padding(.top, short ? 10 : 28)
+ }
+ Spacer(minLength: short ? 6 : 16)
+ // The optical lift: a little more room below than above.
+ Color.clear.frame(height: short ? 14 : 36)
}
}
.sensoryFeedback(.selection, trigger: selected.id)
diff --git a/frontend-ios/Sources/ShellUI/GameDetailView.swift b/frontend-ios/Sources/ShellUI/GameDetailView.swift
index b4625d5f..7aa172d2 100644
--- a/frontend-ios/Sources/ShellUI/GameDetailView.swift
+++ b/frontend-ios/Sources/ShellUI/GameDetailView.swift
@@ -104,7 +104,7 @@ public struct GameDetailView: View {
private func group<Content: View>(_ title: String, @ViewBuilder content: () -> Content) -> some View {
VStack(alignment: .leading, spacing: 12) {
- SectionHeading(title: title).padding(.leading, 4)
+ SectionHeading(title: title)
VStack(alignment: .leading, spacing: 14) { content() }
.frame(maxWidth: .infinity, alignment: .leading)
.shellCard()
diff --git a/frontend-ios/Sources/ShellUI/LibraryView.swift b/frontend-ios/Sources/ShellUI/LibraryView.swift
index 672b4d0c..4dea2db6 100644
--- a/frontend-ios/Sources/ShellUI/LibraryView.swift
+++ b/frontend-ios/Sources/ShellUI/LibraryView.swift
@@ -224,7 +224,8 @@ public struct LibraryView: View {
ScrollViewReader { proxy in
ScrollView {
VStack(alignment: .leading, spacing: 0) {
- PaneBanner(game: selected.game, width: width, topInset: insets.top).id("set.top")
+ PaneBanner(game: selected.game, width: width + insets.leading + insets.trailing,
+ leading: insets.leading, topInset: insets.top).id("set.top")
GameDetailView(detail: selected, actions: actions, showsPrimaryAction: true, showsHeader: false)
.padding(.horizontal, 24).padding(.top, 18).padding(.bottom, 32 + insets.bottom)
// A phone on its side: a readable column, not rows stretched across the whole width.
@@ -344,33 +345,27 @@ public struct LibraryView: View {
/// so the banner's own logo and the title never overlap. Capped in height for a phone on its side.
private struct PaneBanner: View {
let game: GameTile
+ /// The full width, edge to edge under the side safe areas.
let width: CGFloat
+ /// The leading safe area: the words keep it, the banner does not.
+ var leading: CGFloat = 0
/// The status bar's height where the banner runs under it.
var topInset: CGFloat = 0
var body: some View {
let bannerHeight = min(width * 9 / 16, 220) + topInset
- VStack(alignment: .leading, spacing: 8) {
- StatusLabel(state: game.state, prominent: true)
- // Two lines are always reserved, so the settings below start at the same place for every game.
- ZStack(alignment: .topLeading) {
- Text("M\nM").shellType(ShellType.pageTitle).hidden().accessibilityHidden(true)
- Text(game.title).shellType(ShellType.pageTitle)
- .lineLimit(2)
- .accessibilityAddTraits(.isHeader).accessibilityIdentifier("detail.title")
- }
- HStack(spacing: 8) {
- SectionHeading(title: ShellStrings.text("Game settings"))
- if !game.subtitle.isEmpty {
- Text(game.subtitle).shellType(ShellType.note).foregroundStyle(.white.opacity(0.5))
- }
- }.padding(.top, 2)
+ // The words are bottom-aligned in a block that always reserves two lines of title, as in the library hero: a
+ // short title shows more banner above it instead of leaving a hole, and the settings start at the same place.
+ ZStack(alignment: .bottomLeading) {
+ words(title: "M\nM").hidden().accessibilityHidden(true)
+ words(title: game.title)
}
- .padding(.horizontal, 24)
+ .padding(.leading, leading + 24).padding(.trailing, 24)
.padding(.top, bannerHeight - 22)
.frame(maxWidth: .infinity, alignment: .leading)
- .background(alignment: .top) {
+ .background {
+ // The banner fills the whole header edge to edge, cropped as needed, and fades into the page under the words.
ArtView(game: game, lettering: false)
- .frame(width: width, height: bannerHeight)
+ .frame(width: width)
.overlay(alignment: .top) {
// Darker under the status bar, so the time and battery stay legible on any art.
if topInset > 0 {
@@ -378,13 +373,31 @@ private struct PaneBanner: View {
.frame(height: topInset + 50)
}
}
+ .overlay {
+ LinearGradient(stops: [.init(color: .clear, location: 0.35), .init(color: .black.opacity(0.45), location: 0.7),
+ .init(color: .black.opacity(0.6), location: 1)], startPoint: .top, endPoint: .bottom)
+ }
.mask {
- LinearGradient(stops: [.init(color: .black, location: 0), .init(color: .black, location: 0.55),
+ LinearGradient(stops: [.init(color: .black, location: 0), .init(color: .black, location: 0.7),
.init(color: .clear, location: 1)], startPoint: .top, endPoint: .bottom)
}
.accessibilityHidden(true)
}
}
+
+ private func words(title: String) -> some View {
+ VStack(alignment: .leading, spacing: 8) {
+ StatusLabel(state: game.state, prominent: true)
+ Text(title).shellType(ShellType.pageTitle).lineLimit(2)
+ .accessibilityAddTraits(.isHeader).accessibilityIdentifier("detail.title")
+ HStack(spacing: 8) {
+ SectionHeading(title: ShellStrings.text("Game settings"))
+ if !game.subtitle.isEmpty {
+ Text(game.subtitle).shellType(ShellType.note).foregroundStyle(.white.opacity(0.5))
+ }
+ }.padding(.top, 2)
+ }
+ }
}
/// Marks the actions a controller or key press causes, so they are not taken for touch. Not observed.