Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ComputerSolitaire/Views/Cards/CardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ enum CardStyle: String, CaseIterable, Identifiable {
case simple
case pixel

static let defaultValue: CardStyle = .simple
static var defaultValue: CardStyle {
#if os(macOS)
.classic
#else
.simple
#endif
}

var id: String { rawValue }

Expand Down
6 changes: 4 additions & 2 deletions ComputerSolitaire/Views/Cards/Styles/SimpleCardViews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ struct SimpleCardFrontView: View {
ZStack {
SimpleCardBase(fill: SimplePalette.face, chrome: chrome)

HStack(alignment: .firstTextBaseline, spacing: 0) {
HStack(alignment: .top, spacing: 0) {
Text(card.rank.label)
.font(.custom("Charter-Bold", size: cardSize.width * 0.27))
.font(.system(size: cardSize.width * 0.35, weight: .semibold, design: .serif))
.fontWidth(.condensed)
Spacer(minLength: 0)
Image(systemName: card.suit.symbolName)
.font(.system(size: cardSize.width * 0.22, weight: .semibold))
.offset(y: cardSize.width * 0.055)
.accessibilityHidden(true)
}
.foregroundStyle(inkColor)
Expand Down
7 changes: 6 additions & 1 deletion ComputerSolitaireTests/Shared/CardStyleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import XCTest

@MainActor
final class CardStyleTests: XCTestCase {
func testDefaultStyleIsSimple() {
func testDefaultStyleMatchesPlatform() {
#if os(macOS)
XCTAssertEqual(CardStyle.defaultValue, .classic)
XCTAssertEqual(CardStyle.defaultValue.rawValue, "classic")
#else
XCTAssertEqual(CardStyle.defaultValue, .simple)
XCTAssertEqual(CardStyle.defaultValue.rawValue, "simple")
#endif
}

func testOnlyCurrentRawValuesResolveToStyles() {
Expand Down