Skip to content
Open
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
463 changes: 463 additions & 0 deletions .github/scripts/conventions.sh

Large diffs are not rendered by default.

350 changes: 350 additions & 0 deletions .github/scripts/tests/conventions-test.sh

Large diffs are not rendered by default.

20 changes: 19 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@ jobs:
CODE_SIGNING_ALLOWED=NO \
test

conventions:
name: "Conventions: assets, colors, strings"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

# Asset catalog ↔ DashIcon / Color.dash, asset and string bundles, hardcoded
# colors, @available at or below the floor (see the script header).
- name: Check conventions
run: .github/scripts/conventions.sh

# Breaks a copy of the tree once per rule, so a rule that stops matching fails here.
- name: Test the conventions script
run: .github/scripts/tests/conventions-test.sh

actionlint:
name: Lint CI config (actionlint, shellcheck)
runs-on: ubuntu-latest
Expand All @@ -92,4 +110,4 @@ jobs:

# actionlint only checks inline run: blocks.
- name: Run shellcheck on scripts
run: shellcheck .github/scripts/*.sh
run: shellcheck .github/scripts/*.sh .github/scripts/tests/*.sh
6 changes: 6 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ Sources/DashUIKit/
- **Localization:** user-facing strings use `NSLocalizedString(_, bundle: .module, comment:)`.
- Components are **stateless/value-driven** — state (`@Binding`) and callbacks live with the
host. Don't add view models or persistence here.
- CI enforces the mechanical ones with `.github/scripts/conventions.sh`: `DashIcon` ↔
imagesets, `Color.dash` tokens ↔ colorsets, literal asset names and their bundle, no
colors built from components (`Color(red:…)`, hex), `NSLocalizedString` /
`String(localized:)` with the package bundle, no `@available` at or below the floor.
It does not check system colors (`Color.red`) or `Text("…")` keys. Run it from the repo
root before pushing.

## Build / preview

Expand Down
2 changes: 1 addition & 1 deletion Sources/DashUIKit/Components/RadioButtonRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public struct RadioButtonRow: View {
.frame(width: isSelected ? 21 : 24, height: isSelected ? 21 : 24)
.padding(.trailing, isSelected ? 2 : 0)
case .checkbox:
Image(dash: .custom(isSelected ? "icon_checkbox_square_checked" : "icon_checkbox_square", bundle: .dashUIKit))
(isSelected ? DashIcon.Checkbox.checkmarkChecked : .checkmarkUnchecked).image
.resizable()
.frame(width: 24, height: 24)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ struct ThumbView: View {
.frame(width: 39, height: 24)
.background(Constants.switchThumbFill)
.cornerRadius(Constants.switchThumbRadius)
.shadow(color: Color(red: 0.1, green: 0.13, blue: 0.15).opacity(0.06), radius: 1, x: 0, y: 1)
.shadow(color: Color(red: 0.1, green: 0.13, blue: 0.15).opacity(0.1), radius: 1.5, x: 0, y: 1)
.shadow(color: Color.dash.switchThumbShadow.opacity(0.06), radius: 1, x: 0, y: 1)
.shadow(color: Color.dash.switchThumbShadow.opacity(0.1), radius: 1.5, x: 0, y: 1)
}
}

Expand Down
1 change: 1 addition & 0 deletions Sources/DashUIKit/Foundation/Color+DashUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public enum DashColors {
// MARK: Switch

public static var switchThumbFill: Color { dashAsset("SwitchThumbFill") }
public static var switchThumbShadow: Color { dashAsset("SwitchThumbShadow") }
public static var switchTrackFillOff: Color { dashAsset("SwitchTrackFillOff") }
public static var switchTrackFillOffDisabled: Color { dashAsset("SwitchTrackFillOffDisabled") }
public static var switchTrackFillOn: Color { dashAsset("SwitchTrackFillOn") }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.150",
"green" : "0.130",
"red" : "0.100"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
4 changes: 2 additions & 2 deletions docs/lists-and-rows.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ RadioButtonRow(
```

**`Style`** — `.radio` (a ring that thickens/fills blue when selected) or `.checkbox`
(uses the bundled `icon_checkbox_square[_checked]` assets). Row min-height is 60 with a
subtitle, otherwise 54; the whole row is the tap target.
(draws `DashIcon.Checkbox.checkmarkChecked` / `.checkmarkUnchecked`). Row min-height is
60 with a subtitle, otherwise 54; the whole row is the tap target.

---

Expand Down
Loading