Loading...
Loading...
Compare original and translation side by side
Color.primaryColor(.systemBackground).font(.body)Color.primaryColor(.systemBackground).font(.body)// ✅ Good
struct ExpenseCard: View {
let expense: Expense
var body: some View {
HStack {
Image(systemName: expense.category.icon)
.foregroundStyle(.secondary)
.accessibilityHidden(true)
VStack(alignment: .leading) {
Text(expense.title)
.font(.headline)
Text(expense.date, style: .date)
.font(.subheadline)
.foregroundStyle(.secondary)
}
Spacer()
Text(expense.amount, format: .currency(code: "USD"))
.font(.headline)
}
.padding()
.background(Color(.secondarySystemBackground))
.clipShape(RoundedRectangle(cornerRadius: 12))
.accessibilityElement(children: .combine)
.accessibilityLabel("\(expense.title), \(expense.amount)")
}
}
// ❌ Bad
struct ExpenseCard: View {
var body: some View {
HStack {
Image("custom-icon") // Use SF Symbols
Text("$50.00")
.foregroundColor(Color(hex: "#333")) // Use semantic
}
.frame(height: 30) // Too small for touch
}
}// ✅ 良好示例
struct ExpenseCard: View {
let expense: Expense
var body: some View {
HStack {
Image(systemName: expense.category.icon)
.foregroundStyle(.secondary)
.accessibilityHidden(true)
VStack(alignment: .leading) {
Text(expense.title)
.font(.headline)
Text(expense.date, style: .date)
.font(.subheadline)
.foregroundStyle(.secondary)
}
Spacer()
Text(expense.amount, format: .currency(code: "USD"))
.font(.headline)
}
.padding()
.background(Color(.secondarySystemBackground))
.clipShape(RoundedRectangle(cornerRadius: 12))
.accessibilityElement(children: .combine)
.accessibilityLabel("\(expense.title), \(expense.amount)")
}
}
// ❌ 不良示例
struct ExpenseCard: View {
var body: some View {
HStack {
Image("custom-icon") // 应使用SF Symbols
Text("$50.00")
.foregroundColor(Color(hex: "#333")) // 应使用语义化颜色
}
.frame(height: 30) // 触摸目标尺寸过小
}
}User: Create a settings screen with profile section and preferences
Claude: [Generates SwiftUI code]
- SettingsView with List and sections
- ProfileHeaderView component
- PreferenceRow reusable component
- All using semantic colors and SF Symbols用户:创建一个包含个人资料板块和偏好设置的设置界面
Claude: [Generates SwiftUI code]
- 带List和分区的SettingsView
- ProfileHeaderView组件
- 可复用的PreferenceRow组件
- 全部使用语义化颜色和SF Symbolsios-design-reviewios-hig-referenceios-design-reviewios-hig-reference