@sylix/coworker 2.0.11 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/slash/config.d.ts.map +1 -1
- package/dist/commands/slash/config.js +22 -4
- package/dist/commands/slash/config.js.map +1 -1
- package/dist/core/CoWorkerAgent.d.ts.map +1 -1
- package/dist/core/CoWorkerAgent.js +6 -3
- package/dist/core/CoWorkerAgent.js.map +1 -1
- package/dist/skills/defaults/accessibility/screen-reader-testing.md +545 -0
- package/dist/skills/defaults/accessibility/wcag-audit-patterns.md +555 -0
- package/dist/skills/defaults/ai-ml/rag.md +276 -0
- package/dist/skills/defaults/backend-development/api-design-principles.md +528 -0
- package/dist/skills/defaults/backend-development/api-design.md +285 -0
- package/dist/skills/defaults/backend-development/architecture-patterns.md +494 -0
- package/dist/skills/defaults/backend-development/async-python.md +237 -0
- package/dist/skills/defaults/backend-development/auth-implementation-patterns.md +638 -0
- package/dist/skills/defaults/backend-development/bazel-build-optimization.md +387 -0
- package/dist/skills/defaults/backend-development/billing-automation/SKILL.md +566 -0
- package/dist/skills/defaults/backend-development/code-review-excellence.md +538 -0
- package/dist/skills/defaults/backend-development/cqrs-implementation.md +554 -0
- package/dist/skills/defaults/backend-development/database-design.md +305 -0
- package/dist/skills/defaults/backend-development/debugging-strategies.md +536 -0
- package/dist/skills/defaults/backend-development/e2e-testing-patterns.md +544 -0
- package/dist/skills/defaults/backend-development/error-handling-patterns.md +641 -0
- package/dist/skills/defaults/backend-development/fastapi-templates.md +559 -0
- package/dist/skills/defaults/backend-development/fastapi.md +309 -0
- package/dist/skills/defaults/backend-development/git-advanced-workflows.md +405 -0
- package/dist/skills/defaults/backend-development/microservices-patterns.md +595 -0
- package/dist/skills/defaults/backend-development/microservices.md +284 -0
- package/dist/skills/defaults/backend-development/monorepo-management.md +623 -0
- package/dist/skills/defaults/backend-development/nodejs-backend-patterns.md +1048 -0
- package/dist/skills/defaults/backend-development/nx-workspace-patterns.md +457 -0
- package/dist/skills/defaults/backend-development/paypal-integration/SKILL.md +478 -0
- package/dist/skills/defaults/backend-development/pci-compliance/SKILL.md +480 -0
- package/dist/skills/defaults/backend-development/python-anti-patterns.md +349 -0
- package/dist/skills/defaults/backend-development/python-background-jobs.md +364 -0
- package/dist/skills/defaults/backend-development/python-code-style.md +360 -0
- package/dist/skills/defaults/backend-development/python-configuration.md +368 -0
- package/dist/skills/defaults/backend-development/python-design-patterns.md +296 -0
- package/dist/skills/defaults/backend-development/python-error-handling.md +323 -0
- package/dist/skills/defaults/backend-development/python-packaging.md +887 -0
- package/dist/skills/defaults/backend-development/python-performance-optimization.md +874 -0
- package/dist/skills/defaults/backend-development/python-project-structure.md +252 -0
- package/dist/skills/defaults/backend-development/python-resilience.md +376 -0
- package/dist/skills/defaults/backend-development/python-resource-management.md +421 -0
- package/dist/skills/defaults/backend-development/python-type-safety.md +428 -0
- package/dist/skills/defaults/backend-development/sql-optimization-patterns.md +509 -0
- package/dist/skills/defaults/backend-development/stripe-integration/SKILL.md +522 -0
- package/dist/skills/defaults/backend-development/turborepo-caching.md +376 -0
- package/dist/skills/defaults/blockchain/defi-protocol-templates.md +430 -0
- package/dist/skills/defaults/blockchain/nft-standards.md +364 -0
- package/dist/skills/defaults/blockchain/solidity-security.md +514 -0
- package/dist/skills/defaults/blockchain/web3-testing.md +360 -0
- package/dist/skills/defaults/business/competitive-landscape/SKILL.md +527 -0
- package/dist/skills/defaults/business/market-sizing-analysis/SKILL.md +451 -0
- package/dist/skills/defaults/business/startup-financial-modeling/SKILL.md +494 -0
- package/dist/skills/defaults/business/startup-metrics-framework/SKILL.md +564 -0
- package/dist/skills/defaults/business/team-composition-analysis.md +437 -0
- package/dist/skills/defaults/compliance/employment-contract-templates/SKILL.md +527 -0
- package/dist/skills/defaults/compliance/gdpr-data-handling/SKILL.md +630 -0
- package/dist/skills/defaults/data-engineering/airflow-dag-patterns.md +436 -0
- package/dist/skills/defaults/data-engineering/airflow.md +519 -0
- package/dist/skills/defaults/data-engineering/data-quality.md +583 -0
- package/dist/skills/defaults/data-engineering/dbt-transformation-patterns.md +482 -0
- package/dist/skills/defaults/data-engineering/dbt.md +556 -0
- package/dist/skills/defaults/data-engineering/ml-pipeline-workflow/SKILL.md +247 -0
- package/dist/skills/defaults/data-engineering/spark-optimization.md +348 -0
- package/dist/skills/defaults/data-engineering/spark.md +411 -0
- package/dist/skills/defaults/database/postgresql.md +202 -0
- package/dist/skills/defaults/debugging/systematic-debugging.md +249 -0
- package/dist/skills/defaults/devops/architecture-decision-records.md +448 -0
- package/dist/skills/defaults/devops/changelog-automation.md +580 -0
- package/dist/skills/defaults/devops/cicd.md +314 -0
- package/dist/skills/defaults/devops/cloud.md +263 -0
- package/dist/skills/defaults/devops/code-review-excellence.md +299 -0
- package/dist/skills/defaults/devops/cost-optimization.md +295 -0
- package/dist/skills/defaults/devops/deployment-pipeline-design.md +356 -0
- package/dist/skills/defaults/devops/docker.md +281 -0
- package/dist/skills/defaults/devops/git-workflows.md +205 -0
- package/dist/skills/defaults/devops/github-actions.md +311 -0
- package/dist/skills/defaults/devops/gitlab-ci-patterns.md +266 -0
- package/dist/skills/defaults/devops/hybrid-cloud-networking.md +241 -0
- package/dist/skills/defaults/devops/istio-traffic-management.md +327 -0
- package/dist/skills/defaults/devops/kubernetes.md +339 -0
- package/dist/skills/defaults/devops/linkerd-patterns.md +311 -0
- package/dist/skills/defaults/devops/multi-cloud-architecture.md +181 -0
- package/dist/skills/defaults/devops/observability.md +243 -0
- package/dist/skills/defaults/devops/openapi-spec-generation.md +1024 -0
- package/dist/skills/defaults/devops/postmortem-writing.md +396 -0
- package/dist/skills/defaults/devops/prometheus-configuration.md +265 -0
- package/dist/skills/defaults/devops/secrets-management.md +341 -0
- package/dist/skills/defaults/devops/service-mesh-observability.md +385 -0
- package/dist/skills/defaults/devops/terraform-module-library.md +244 -0
- package/dist/skills/defaults/finance/backtesting-frameworks/SKILL.md +663 -0
- package/dist/skills/defaults/finance/risk-metrics-calculation/SKILL.md +557 -0
- package/dist/skills/defaults/frontend/accessibility-compliance.md +420 -0
- package/dist/skills/defaults/frontend/design-system-patterns.md +337 -0
- package/dist/skills/defaults/frontend/interaction-design.md +327 -0
- package/dist/skills/defaults/frontend/javascript.md +311 -0
- package/dist/skills/defaults/frontend/modern-javascript-patterns.md +927 -0
- package/dist/skills/defaults/frontend/react-native-design.md +440 -0
- package/dist/skills/defaults/frontend/react.md +345 -0
- package/dist/skills/defaults/frontend/responsive-design.md +472 -0
- package/dist/skills/defaults/frontend/tailwind-design-system.md +337 -0
- package/dist/skills/defaults/frontend/typescript-advanced-types.md +724 -0
- package/dist/skills/defaults/frontend/typescript.md +334 -0
- package/dist/skills/defaults/frontend/visual-design-foundations.md +326 -0
- package/dist/skills/defaults/frontend/web-component-design.md +279 -0
- package/dist/skills/defaults/game-development/godot-gdscript-patterns.md +188 -0
- package/dist/skills/defaults/game-development/unity-ecs-patterns.md +594 -0
- package/dist/skills/defaults/kubernetes/gitops-workflow.md +285 -0
- package/dist/skills/defaults/kubernetes/gitops.md +280 -0
- package/dist/skills/defaults/kubernetes/helm-chart-scaffolding.md +553 -0
- package/dist/skills/defaults/kubernetes/helm.md +343 -0
- package/dist/skills/defaults/kubernetes/k8s-manifest-generator.md +501 -0
- package/dist/skills/defaults/kubernetes/k8s-security-policies.md +342 -0
- package/dist/skills/defaults/kubernetes/manifests.md +330 -0
- package/dist/skills/defaults/kubernetes/security.md +337 -0
- package/dist/skills/defaults/llm-application/embedding-strategies.md +608 -0
- package/dist/skills/defaults/llm-application/hybrid-search-implementation.md +570 -0
- package/dist/skills/defaults/llm-application/hybrid-search.md +570 -0
- package/dist/skills/defaults/llm-application/langchain-architecture.md +666 -0
- package/dist/skills/defaults/llm-application/langchain.md +259 -0
- package/dist/skills/defaults/llm-application/llm-evaluation.md +695 -0
- package/dist/skills/defaults/llm-application/prompt-engineering-patterns.md +449 -0
- package/dist/skills/defaults/llm-application/prompt-engineering.md +219 -0
- package/dist/skills/defaults/llm-application/rag-implementation.md +434 -0
- package/dist/skills/defaults/llm-application/similarity-search-patterns.md +560 -0
- package/dist/skills/defaults/llm-application/similarity-search.md +560 -0
- package/dist/skills/defaults/llm-application/vector-index-tuning.md +523 -0
- package/dist/skills/defaults/mobile/mobile-android-design.md +440 -0
- package/dist/skills/defaults/mobile/mobile-ios-design.md +266 -0
- package/dist/skills/defaults/monitoring/distributed-tracing.md +436 -0
- package/dist/skills/defaults/monitoring/grafana-dashboards.md +370 -0
- package/dist/skills/defaults/monitoring/prometheus-configuration.md +379 -0
- package/dist/skills/defaults/monitoring/slo-implementation.md +323 -0
- package/dist/skills/defaults/refactoring/code-refactoring.md +349 -0
- package/dist/skills/defaults/security/anti-reversing-techniques/SKILL.md +559 -0
- package/dist/skills/defaults/security/auditor.md +168 -0
- package/dist/skills/defaults/security/binary-analysis-patterns/SKILL.md +438 -0
- package/dist/skills/defaults/security/memory-forensics/SKILL.md +483 -0
- package/dist/skills/defaults/security/mtls-configuration.md +349 -0
- package/dist/skills/defaults/security/protocol-reverse-engineering/SKILL.md +520 -0
- package/dist/skills/defaults/security/sast-configuration.md +182 -0
- package/dist/skills/defaults/security/security.md +313 -0
- package/dist/skills/defaults/security/stride-analysis.md +273 -0
- package/dist/skills/defaults/security/threat-mitigation-mapping.md +290 -0
- package/dist/skills/defaults/systems/bash-defensive-patterns/SKILL.md +539 -0
- package/dist/skills/defaults/systems/bats-testing-patterns/SKILL.md +631 -0
- package/dist/skills/defaults/systems/go-concurrency-patterns.md +657 -0
- package/dist/skills/defaults/systems/memory-safety-patterns.md +605 -0
- package/dist/skills/defaults/systems/rust-async-patterns.md +519 -0
- package/dist/skills/defaults/systems/shellcheck-configuration/SKILL.md +456 -0
- package/dist/skills/defaults/team-collaboration/multi-reviewer-patterns.md +126 -0
- package/dist/skills/defaults/team-collaboration/parallel-feature-development.md +151 -0
- package/dist/skills/defaults/testing/javascript-testing-patterns.md +1021 -0
- package/dist/skills/defaults/testing/python-testing-patterns.md +351 -0
- package/dist/skills/defaults/testing/testing.md +332 -0
- package/dist/skills/defaults/workflows/context-driven-development.md +384 -0
- package/dist/skills/defaults/workflows/track-management.md +592 -0
- package/dist/skills/defaults/workflows/workflow-patterns.md +622 -0
- package/dist/skills/index.d.ts +11 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +129 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/utils/character.js +4 -4
- package/dist/utils/character.js.map +1 -1
- package/dist/utils/inputbar.d.ts.map +1 -1
- package/dist/utils/inputbar.js +7 -0
- package/dist/utils/inputbar.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mobile-android-design
|
|
3
|
+
description: Master Material Design 3 and Jetpack Compose patterns for building native Android apps. Use when designing Android interfaces, implementing Compose UI, or following Google's Material Design guidelines.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Android Mobile Design
|
|
7
|
+
|
|
8
|
+
Master Material Design 3 (Material You) and Jetpack Compose to build modern, adaptive Android applications that integrate seamlessly with the Android ecosystem.
|
|
9
|
+
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
- Designing Android app interfaces following Material Design 3
|
|
13
|
+
- Building Jetpack Compose UI and layouts
|
|
14
|
+
- Implementing Android navigation patterns (Navigation Compose)
|
|
15
|
+
- Creating adaptive layouts for phones, tablets, and foldables
|
|
16
|
+
- Using Material 3 theming with dynamic colors
|
|
17
|
+
- Building accessible Android interfaces
|
|
18
|
+
- Implementing Android-specific gestures and interactions
|
|
19
|
+
- Designing for different screen configurations
|
|
20
|
+
|
|
21
|
+
## Core Concepts
|
|
22
|
+
|
|
23
|
+
### 1. Material Design 3 Principles
|
|
24
|
+
|
|
25
|
+
**Personalization**: Dynamic color adapts UI to user's wallpaper
|
|
26
|
+
**Accessibility**: Tonal palettes ensure sufficient color contrast
|
|
27
|
+
**Large Screens**: Responsive layouts for tablets and foldables
|
|
28
|
+
|
|
29
|
+
**Material Components:**
|
|
30
|
+
|
|
31
|
+
- Cards, Buttons, FABs, Chips
|
|
32
|
+
- Navigation (rail, drawer, bottom nav)
|
|
33
|
+
- Text fields, Dialogs, Sheets
|
|
34
|
+
- Lists, Menus, Progress indicators
|
|
35
|
+
|
|
36
|
+
### 2. Jetpack Compose Layout System
|
|
37
|
+
|
|
38
|
+
**Column and Row:**
|
|
39
|
+
|
|
40
|
+
```kotlin
|
|
41
|
+
// Vertical arrangement with alignment
|
|
42
|
+
Column(
|
|
43
|
+
modifier = Modifier.padding(16.dp),
|
|
44
|
+
verticalArrangement = Arrangement.spacedBy(12.dp),
|
|
45
|
+
horizontalAlignment = Alignment.Start
|
|
46
|
+
) {
|
|
47
|
+
Text(
|
|
48
|
+
text = "Title",
|
|
49
|
+
style = MaterialTheme.typography.headlineSmall
|
|
50
|
+
)
|
|
51
|
+
Text(
|
|
52
|
+
text = "Subtitle",
|
|
53
|
+
style = MaterialTheme.typography.bodyMedium,
|
|
54
|
+
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Horizontal arrangement with weight
|
|
59
|
+
Row(
|
|
60
|
+
modifier = Modifier.fillMaxWidth(),
|
|
61
|
+
horizontalArrangement = Arrangement.SpaceBetween,
|
|
62
|
+
verticalAlignment = Alignment.CenterVertically
|
|
63
|
+
) {
|
|
64
|
+
Icon(Icons.Default.Star, contentDescription = null)
|
|
65
|
+
Text("Featured")
|
|
66
|
+
Spacer(modifier = Modifier.weight(1f))
|
|
67
|
+
TextButton(onClick = {}) {
|
|
68
|
+
Text("View All")
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Lazy Lists and Grids:**
|
|
74
|
+
|
|
75
|
+
```kotlin
|
|
76
|
+
// Lazy column with sticky headers
|
|
77
|
+
LazyColumn {
|
|
78
|
+
items.groupBy { it.category }.forEach { (category, categoryItems) ->
|
|
79
|
+
stickyHeader {
|
|
80
|
+
Text(
|
|
81
|
+
text = category,
|
|
82
|
+
modifier = Modifier
|
|
83
|
+
.fillMaxWidth()
|
|
84
|
+
.background(MaterialTheme.colorScheme.surface)
|
|
85
|
+
.padding(16.dp),
|
|
86
|
+
style = MaterialTheme.typography.titleMedium
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
items(categoryItems) { item ->
|
|
90
|
+
ItemRow(item = item)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Adaptive grid
|
|
96
|
+
LazyVerticalGrid(
|
|
97
|
+
columns = GridCells.Adaptive(minSize = 150.dp),
|
|
98
|
+
contentPadding = PaddingValues(16.dp),
|
|
99
|
+
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
|
100
|
+
verticalArrangement = Arrangement.spacedBy(12.dp)
|
|
101
|
+
) {
|
|
102
|
+
items(items) { item ->
|
|
103
|
+
ItemCard(item = item)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 3. Navigation Patterns
|
|
109
|
+
|
|
110
|
+
**Bottom Navigation:**
|
|
111
|
+
|
|
112
|
+
```kotlin
|
|
113
|
+
@Composable
|
|
114
|
+
fun MainScreen() {
|
|
115
|
+
val navController = rememberNavController()
|
|
116
|
+
|
|
117
|
+
Scaffold(
|
|
118
|
+
bottomBar = {
|
|
119
|
+
NavigationBar {
|
|
120
|
+
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
|
121
|
+
val currentDestination = navBackStackEntry?.destination
|
|
122
|
+
|
|
123
|
+
NavigationDestination.entries.forEach { destination ->
|
|
124
|
+
NavigationBarItem(
|
|
125
|
+
icon = { Icon(destination.icon, contentDescription = null) },
|
|
126
|
+
label = { Text(destination.label) },
|
|
127
|
+
selected = currentDestination?.hierarchy?.any {
|
|
128
|
+
it.route == destination.route
|
|
129
|
+
} == true,
|
|
130
|
+
onClick = {
|
|
131
|
+
navController.navigate(destination.route) {
|
|
132
|
+
popUpTo(navController.graph.findStartDestination().id) {
|
|
133
|
+
saveState = true
|
|
134
|
+
}
|
|
135
|
+
launchSingleTop = true
|
|
136
|
+
restoreState = true
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
) { innerPadding ->
|
|
144
|
+
NavHost(
|
|
145
|
+
navController = navController,
|
|
146
|
+
startDestination = NavigationDestination.Home.route,
|
|
147
|
+
modifier = Modifier.padding(innerPadding)
|
|
148
|
+
) {
|
|
149
|
+
composable(NavigationDestination.Home.route) { HomeScreen() }
|
|
150
|
+
composable(NavigationDestination.Search.route) { SearchScreen() }
|
|
151
|
+
composable(NavigationDestination.Profile.route) { ProfileScreen() }
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Navigation Drawer:**
|
|
158
|
+
|
|
159
|
+
```kotlin
|
|
160
|
+
@Composable
|
|
161
|
+
fun DrawerNavigation() {
|
|
162
|
+
val drawerState = rememberDrawerState(DrawerValue.Closed)
|
|
163
|
+
val scope = rememberCoroutineScope()
|
|
164
|
+
|
|
165
|
+
ModalNavigationDrawer(
|
|
166
|
+
drawerState = drawerState,
|
|
167
|
+
drawerContent = {
|
|
168
|
+
ModalDrawerSheet {
|
|
169
|
+
Spacer(Modifier.height(12.dp))
|
|
170
|
+
Text(
|
|
171
|
+
"App Name",
|
|
172
|
+
modifier = Modifier.padding(16.dp),
|
|
173
|
+
style = MaterialTheme.typography.titleLarge
|
|
174
|
+
)
|
|
175
|
+
HorizontalDivider()
|
|
176
|
+
|
|
177
|
+
NavigationDrawerItem(
|
|
178
|
+
icon = { Icon(Icons.Default.Home, null) },
|
|
179
|
+
label = { Text("Home") },
|
|
180
|
+
selected = true,
|
|
181
|
+
onClick = { scope.launch { drawerState.close() } }
|
|
182
|
+
)
|
|
183
|
+
NavigationDrawerItem(
|
|
184
|
+
icon = { Icon(Icons.Default.Settings, null) },
|
|
185
|
+
label = { Text("Settings") },
|
|
186
|
+
selected = false,
|
|
187
|
+
onClick = { }
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
) {
|
|
192
|
+
Scaffold(
|
|
193
|
+
topBar = {
|
|
194
|
+
TopAppBar(
|
|
195
|
+
title = { Text("Home") },
|
|
196
|
+
navigationIcon = {
|
|
197
|
+
IconButton(onClick = { scope.launch { drawerState.open() } }) {
|
|
198
|
+
Icon(Icons.Default.Menu, contentDescription = "Menu")
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
) { innerPadding ->
|
|
204
|
+
Content(modifier = Modifier.padding(innerPadding))
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 4. Material 3 Theming
|
|
211
|
+
|
|
212
|
+
**Color Scheme:**
|
|
213
|
+
|
|
214
|
+
```kotlin
|
|
215
|
+
// Dynamic color (Android 12+)
|
|
216
|
+
val dynamicColorScheme = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
217
|
+
val context = LocalContext.current
|
|
218
|
+
if (darkTheme) dynamicDarkColorScheme(context)
|
|
219
|
+
else dynamicLightColorScheme(context)
|
|
220
|
+
} else {
|
|
221
|
+
if (darkTheme) DarkColorScheme else LightColorScheme
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Custom color scheme
|
|
225
|
+
private val LightColorScheme = lightColorScheme(
|
|
226
|
+
primary = Color(0xFF6750A4),
|
|
227
|
+
onPrimary = Color.White,
|
|
228
|
+
primaryContainer = Color(0xFFEADDFF),
|
|
229
|
+
onPrimaryContainer = Color(0xFF21005D),
|
|
230
|
+
secondary = Color(0xFF625B71),
|
|
231
|
+
onSecondary = Color.White,
|
|
232
|
+
tertiary = Color(0xFF7D5260),
|
|
233
|
+
onTertiary = Color.White,
|
|
234
|
+
surface = Color(0xFFFFFBFE),
|
|
235
|
+
onSurface = Color(0xFF1C1B1F),
|
|
236
|
+
)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Typography:**
|
|
240
|
+
|
|
241
|
+
```kotlin
|
|
242
|
+
val AppTypography = Typography(
|
|
243
|
+
displayLarge = TextStyle(
|
|
244
|
+
fontFamily = FontFamily.Default,
|
|
245
|
+
fontWeight = FontWeight.Normal,
|
|
246
|
+
fontSize = 57.sp,
|
|
247
|
+
lineHeight = 64.sp
|
|
248
|
+
),
|
|
249
|
+
headlineMedium = TextStyle(
|
|
250
|
+
fontFamily = FontFamily.Default,
|
|
251
|
+
fontWeight = FontWeight.Normal,
|
|
252
|
+
fontSize = 28.sp,
|
|
253
|
+
lineHeight = 36.sp
|
|
254
|
+
),
|
|
255
|
+
titleLarge = TextStyle(
|
|
256
|
+
fontFamily = FontFamily.Default,
|
|
257
|
+
fontWeight = FontWeight.Normal,
|
|
258
|
+
fontSize = 22.sp,
|
|
259
|
+
lineHeight = 28.sp
|
|
260
|
+
),
|
|
261
|
+
bodyLarge = TextStyle(
|
|
262
|
+
fontFamily = FontFamily.Default,
|
|
263
|
+
fontWeight = FontWeight.Normal,
|
|
264
|
+
fontSize = 16.sp,
|
|
265
|
+
lineHeight = 24.sp
|
|
266
|
+
),
|
|
267
|
+
labelMedium = TextStyle(
|
|
268
|
+
fontFamily = FontFamily.Default,
|
|
269
|
+
fontWeight = FontWeight.Medium,
|
|
270
|
+
fontSize = 12.sp,
|
|
271
|
+
lineHeight = 16.sp
|
|
272
|
+
)
|
|
273
|
+
)
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### 5. Component Examples
|
|
277
|
+
|
|
278
|
+
**Cards:**
|
|
279
|
+
|
|
280
|
+
```kotlin
|
|
281
|
+
@Composable
|
|
282
|
+
fun FeatureCard(
|
|
283
|
+
title: String,
|
|
284
|
+
description: String,
|
|
285
|
+
imageUrl: String,
|
|
286
|
+
onClick: () -> Unit
|
|
287
|
+
) {
|
|
288
|
+
Card(
|
|
289
|
+
onClick = onClick,
|
|
290
|
+
modifier = Modifier.fillMaxWidth(),
|
|
291
|
+
shape = RoundedCornerShape(16.dp),
|
|
292
|
+
colors = CardDefaults.cardColors(
|
|
293
|
+
containerColor = MaterialTheme.colorScheme.surfaceVariant
|
|
294
|
+
)
|
|
295
|
+
) {
|
|
296
|
+
Column {
|
|
297
|
+
AsyncImage(
|
|
298
|
+
model = imageUrl,
|
|
299
|
+
contentDescription = null,
|
|
300
|
+
modifier = Modifier
|
|
301
|
+
.fillMaxWidth()
|
|
302
|
+
.height(180.dp),
|
|
303
|
+
contentScale = ContentScale.Crop
|
|
304
|
+
)
|
|
305
|
+
Column(modifier = Modifier.padding(16.dp)) {
|
|
306
|
+
Text(
|
|
307
|
+
text = title,
|
|
308
|
+
style = MaterialTheme.typography.titleMedium
|
|
309
|
+
)
|
|
310
|
+
Spacer(modifier = Modifier.height(8.dp))
|
|
311
|
+
Text(
|
|
312
|
+
text = description,
|
|
313
|
+
style = MaterialTheme.typography.bodyMedium,
|
|
314
|
+
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
315
|
+
)
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**Buttons:**
|
|
323
|
+
|
|
324
|
+
```kotlin
|
|
325
|
+
// Filled button (primary action)
|
|
326
|
+
Button(onClick = { }) {
|
|
327
|
+
Text("Continue")
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Filled tonal button (secondary action)
|
|
331
|
+
FilledTonalButton(onClick = { }) {
|
|
332
|
+
Icon(Icons.Default.Add, null)
|
|
333
|
+
Spacer(Modifier.width(8.dp))
|
|
334
|
+
Text("Add Item")
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Outlined button
|
|
338
|
+
OutlinedButton(onClick = { }) {
|
|
339
|
+
Text("Cancel")
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// Text button
|
|
343
|
+
TextButton(onClick = { }) {
|
|
344
|
+
Text("Learn More")
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// FAB
|
|
348
|
+
FloatingActionButton(
|
|
349
|
+
onClick = { },
|
|
350
|
+
containerColor = MaterialTheme.colorScheme.primaryContainer,
|
|
351
|
+
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
|
|
352
|
+
) {
|
|
353
|
+
Icon(Icons.Default.Add, contentDescription = "Add")
|
|
354
|
+
}
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## Quick Start Component
|
|
358
|
+
|
|
359
|
+
```kotlin
|
|
360
|
+
@Composable
|
|
361
|
+
fun ItemListCard(
|
|
362
|
+
item: Item,
|
|
363
|
+
onItemClick: () -> Unit,
|
|
364
|
+
modifier: Modifier = Modifier
|
|
365
|
+
) {
|
|
366
|
+
Card(
|
|
367
|
+
onClick = onItemClick,
|
|
368
|
+
modifier = modifier.fillMaxWidth(),
|
|
369
|
+
shape = RoundedCornerShape(12.dp)
|
|
370
|
+
) {
|
|
371
|
+
Row(
|
|
372
|
+
modifier = Modifier
|
|
373
|
+
.padding(16.dp)
|
|
374
|
+
.fillMaxWidth(),
|
|
375
|
+
verticalAlignment = Alignment.CenterVertically
|
|
376
|
+
) {
|
|
377
|
+
Box(
|
|
378
|
+
modifier = Modifier
|
|
379
|
+
.size(48.dp)
|
|
380
|
+
.clip(CircleShape)
|
|
381
|
+
.background(MaterialTheme.colorScheme.primaryContainer),
|
|
382
|
+
contentAlignment = Alignment.Center
|
|
383
|
+
) {
|
|
384
|
+
Icon(
|
|
385
|
+
imageVector = Icons.Default.Star,
|
|
386
|
+
contentDescription = null,
|
|
387
|
+
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
|
388
|
+
)
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
Spacer(modifier = Modifier.width(16.dp))
|
|
392
|
+
|
|
393
|
+
Column(modifier = Modifier.weight(1f)) {
|
|
394
|
+
Text(
|
|
395
|
+
text = item.title,
|
|
396
|
+
style = MaterialTheme.typography.titleMedium
|
|
397
|
+
)
|
|
398
|
+
Text(
|
|
399
|
+
text = item.subtitle,
|
|
400
|
+
style = MaterialTheme.typography.bodyMedium,
|
|
401
|
+
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
402
|
+
)
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
Icon(
|
|
406
|
+
imageVector = Icons.Default.ChevronRight,
|
|
407
|
+
contentDescription = null,
|
|
408
|
+
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
|
409
|
+
)
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
## Best Practices
|
|
416
|
+
|
|
417
|
+
1. **Use Material Theme**: Access colors via `MaterialTheme.colorScheme` for automatic dark mode support
|
|
418
|
+
2. **Support Dynamic Color**: Enable dynamic color on Android 12+ for personalization
|
|
419
|
+
3. **Adaptive Layouts**: Use `WindowSizeClass` for responsive designs
|
|
420
|
+
4. **Content Descriptions**: Add `contentDescription` to all interactive elements
|
|
421
|
+
5. **Touch Targets**: Minimum 48dp touch targets for accessibility
|
|
422
|
+
6. **State Hoisting**: Hoist state to make components reusable and testable
|
|
423
|
+
7. **Remember Properly**: Use `remember` and `rememberSaveable` appropriately
|
|
424
|
+
8. **Preview Annotations**: Add `@Preview` with different configurations
|
|
425
|
+
|
|
426
|
+
## Common Issues
|
|
427
|
+
|
|
428
|
+
- **Recomposition Issues**: Avoid passing unstable lambdas; use `remember`
|
|
429
|
+
- **State Loss**: Use `rememberSaveable` for configuration changes
|
|
430
|
+
- **Performance**: Use `LazyColumn` instead of `Column` for long lists
|
|
431
|
+
- **Theme Leaks**: Ensure `MaterialTheme` wraps all composables
|
|
432
|
+
- **Navigation Crashes**: Handle back press and deep links properly
|
|
433
|
+
- **Memory Leaks**: Cancel coroutines in `DisposableEffect`
|
|
434
|
+
|
|
435
|
+
## Resources
|
|
436
|
+
|
|
437
|
+
- [Material Design 3](https://m3.material.io/)
|
|
438
|
+
- [Jetpack Compose Documentation](https://developer.android.com/jetpack/compose)
|
|
439
|
+
- [Compose Samples](https://github.com/android/compose-samples)
|
|
440
|
+
- [Material 3 Compose](https://developer.android.com/jetpack/compose/designsystems/material3)
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mobile-ios-design
|
|
3
|
+
description: Master iOS Human Interface Guidelines and SwiftUI patterns for building native iOS apps. Use when designing iOS interfaces, implementing SwiftUI views, or ensuring apps follow Apple's design principles.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# iOS Mobile Design
|
|
7
|
+
|
|
8
|
+
Master iOS Human Interface Guidelines (HIG) and SwiftUI patterns to build polished, native iOS applications that feel at home on Apple platforms.
|
|
9
|
+
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
- Designing iOS app interfaces following Apple HIG
|
|
13
|
+
- Building SwiftUI views and layouts
|
|
14
|
+
- Implementing iOS navigation patterns (NavigationStack, TabView, sheets)
|
|
15
|
+
- Creating adaptive layouts for iPhone and iPad
|
|
16
|
+
- Using SF Symbols and system typography
|
|
17
|
+
- Building accessible iOS interfaces
|
|
18
|
+
- Implementing iOS-specific gestures and interactions
|
|
19
|
+
- Designing for Dynamic Type and Dark Mode
|
|
20
|
+
|
|
21
|
+
## Core Concepts
|
|
22
|
+
|
|
23
|
+
### 1. Human Interface Guidelines Principles
|
|
24
|
+
|
|
25
|
+
**Clarity**: Content is legible, icons are precise, adornments are subtle
|
|
26
|
+
**Deference**: UI helps users understand content without competing with it
|
|
27
|
+
**Depth**: Visual layers and motion convey hierarchy and enable navigation
|
|
28
|
+
|
|
29
|
+
**Platform Considerations:**
|
|
30
|
+
|
|
31
|
+
- **iOS**: Touch-first, compact displays, portrait orientation
|
|
32
|
+
- **iPadOS**: Larger canvas, multitasking, pointer support
|
|
33
|
+
- **visionOS**: Spatial computing, eye/hand input
|
|
34
|
+
|
|
35
|
+
### 2. SwiftUI Layout System
|
|
36
|
+
|
|
37
|
+
**Stack-Based Layouts:**
|
|
38
|
+
|
|
39
|
+
```swift
|
|
40
|
+
// Vertical stack with alignment
|
|
41
|
+
VStack(alignment: .leading, spacing: 12) {
|
|
42
|
+
Text("Title")
|
|
43
|
+
.font(.headline)
|
|
44
|
+
Text("Subtitle")
|
|
45
|
+
.font(.subheadline)
|
|
46
|
+
.foregroundStyle(.secondary)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Horizontal stack with flexible spacing
|
|
50
|
+
HStack {
|
|
51
|
+
Image(systemName: "star.fill")
|
|
52
|
+
Text("Featured")
|
|
53
|
+
Spacer()
|
|
54
|
+
Text("View All")
|
|
55
|
+
.foregroundStyle(.blue)
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Grid Layouts:**
|
|
60
|
+
|
|
61
|
+
```swift
|
|
62
|
+
// Adaptive grid that fills available width
|
|
63
|
+
LazyVGrid(columns: [
|
|
64
|
+
GridItem(.adaptive(minimum: 150, maximum: 200))
|
|
65
|
+
], spacing: 16) {
|
|
66
|
+
ForEach(items) { item in
|
|
67
|
+
ItemCard(item: item)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Fixed column grid
|
|
72
|
+
LazyVGrid(columns: [
|
|
73
|
+
GridItem(.flexible()),
|
|
74
|
+
GridItem(.flexible()),
|
|
75
|
+
GridItem(.flexible())
|
|
76
|
+
], spacing: 12) {
|
|
77
|
+
ForEach(items) { item in
|
|
78
|
+
ItemThumbnail(item: item)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 3. Navigation Patterns
|
|
84
|
+
|
|
85
|
+
**NavigationStack (iOS 16+):**
|
|
86
|
+
|
|
87
|
+
```swift
|
|
88
|
+
struct ContentView: View {
|
|
89
|
+
@State private var path = NavigationPath()
|
|
90
|
+
|
|
91
|
+
var body: some View {
|
|
92
|
+
NavigationStack(path: $path) {
|
|
93
|
+
List(items) { item in
|
|
94
|
+
NavigationLink(value: item) {
|
|
95
|
+
ItemRow(item: item)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
.navigationTitle("Items")
|
|
99
|
+
.navigationDestination(for: Item.self) { item in
|
|
100
|
+
ItemDetailView(item: item)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**TabView (iOS 18+):**
|
|
108
|
+
|
|
109
|
+
```swift
|
|
110
|
+
struct MainTabView: View {
|
|
111
|
+
@State private var selectedTab = 0
|
|
112
|
+
|
|
113
|
+
var body: some View {
|
|
114
|
+
TabView(selection: $selectedTab) {
|
|
115
|
+
Tab("Home", systemImage: "house", value: 0) {
|
|
116
|
+
HomeView()
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
Tab("Search", systemImage: "magnifyingglass", value: 1) {
|
|
120
|
+
SearchView()
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
Tab("Profile", systemImage: "person", value: 2) {
|
|
124
|
+
ProfileView()
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 4. System Integration
|
|
132
|
+
|
|
133
|
+
**SF Symbols:**
|
|
134
|
+
|
|
135
|
+
```swift
|
|
136
|
+
// Basic symbol
|
|
137
|
+
Image(systemName: "heart.fill")
|
|
138
|
+
.foregroundStyle(.red)
|
|
139
|
+
|
|
140
|
+
// Symbol with rendering mode
|
|
141
|
+
Image(systemName: "cloud.sun.fill")
|
|
142
|
+
.symbolRenderingMode(.multicolor)
|
|
143
|
+
|
|
144
|
+
// Variable symbol (iOS 16+)
|
|
145
|
+
Image(systemName: "speaker.wave.3.fill", variableValue: volume)
|
|
146
|
+
|
|
147
|
+
// Symbol effect (iOS 17+)
|
|
148
|
+
Image(systemName: "bell.fill")
|
|
149
|
+
.symbolEffect(.bounce, value: notificationCount)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Dynamic Type:**
|
|
153
|
+
|
|
154
|
+
```swift
|
|
155
|
+
// Use semantic fonts
|
|
156
|
+
Text("Headline")
|
|
157
|
+
.font(.headline)
|
|
158
|
+
|
|
159
|
+
Text("Body text that scales with user preferences")
|
|
160
|
+
.font(.body)
|
|
161
|
+
|
|
162
|
+
// Custom font that respects Dynamic Type
|
|
163
|
+
Text("Custom")
|
|
164
|
+
.font(.custom("Avenir", size: 17, relativeTo: .body))
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 5. Visual Design
|
|
168
|
+
|
|
169
|
+
**Colors and Materials:**
|
|
170
|
+
|
|
171
|
+
```swift
|
|
172
|
+
// Semantic colors that adapt to light/dark mode
|
|
173
|
+
Text("Primary")
|
|
174
|
+
.foregroundStyle(.primary)
|
|
175
|
+
Text("Secondary")
|
|
176
|
+
.foregroundStyle(.secondary)
|
|
177
|
+
|
|
178
|
+
// System materials for blur effects
|
|
179
|
+
Rectangle()
|
|
180
|
+
.fill(.ultraThinMaterial)
|
|
181
|
+
.frame(height: 100)
|
|
182
|
+
|
|
183
|
+
// Vibrant materials for overlays
|
|
184
|
+
Text("Overlay")
|
|
185
|
+
.padding()
|
|
186
|
+
.background(.regularMaterial, in: RoundedRectangle(cornerRadius: 12))
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Shadows and Depth:**
|
|
190
|
+
|
|
191
|
+
```swift
|
|
192
|
+
// Standard card shadow
|
|
193
|
+
RoundedRectangle(cornerRadius: 16)
|
|
194
|
+
.fill(.background)
|
|
195
|
+
.shadow(color: .black.opacity(0.1), radius: 8, y: 4)
|
|
196
|
+
|
|
197
|
+
// Elevated appearance
|
|
198
|
+
.shadow(radius: 2, y: 1)
|
|
199
|
+
.shadow(radius: 8, y: 4)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Quick Start Component
|
|
203
|
+
|
|
204
|
+
```swift
|
|
205
|
+
import SwiftUI
|
|
206
|
+
|
|
207
|
+
struct FeatureCard: View {
|
|
208
|
+
let title: String
|
|
209
|
+
let description: String
|
|
210
|
+
let systemImage: String
|
|
211
|
+
|
|
212
|
+
var body: some View {
|
|
213
|
+
HStack(spacing: 16) {
|
|
214
|
+
Image(systemName: systemImage)
|
|
215
|
+
.font(.title)
|
|
216
|
+
.foregroundStyle(.blue)
|
|
217
|
+
.frame(width: 44, height: 44)
|
|
218
|
+
.background(.blue.opacity(0.1), in: Circle())
|
|
219
|
+
|
|
220
|
+
VStack(alignment: .leading, spacing: 4) {
|
|
221
|
+
Text(title)
|
|
222
|
+
.font(.headline)
|
|
223
|
+
Text(description)
|
|
224
|
+
.font(.subheadline)
|
|
225
|
+
.foregroundStyle(.secondary)
|
|
226
|
+
.lineLimit(2)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
Spacer()
|
|
230
|
+
|
|
231
|
+
Image(systemName: "chevron.right")
|
|
232
|
+
.foregroundStyle(.tertiary)
|
|
233
|
+
}
|
|
234
|
+
.padding()
|
|
235
|
+
.background(.background, in: RoundedRectangle(cornerRadius: 12))
|
|
236
|
+
.shadow(color: .black.opacity(0.05), radius: 4, y: 2)
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Best Practices
|
|
242
|
+
|
|
243
|
+
1. **Use Semantic Colors**: Always use `.primary`, `.secondary`, `.background` for automatic light/dark mode support
|
|
244
|
+
2. **Embrace SF Symbols**: Use system symbols for consistency and automatic accessibility
|
|
245
|
+
3. **Support Dynamic Type**: Use semantic fonts (`.body`, `.headline`) instead of fixed sizes
|
|
246
|
+
4. **Add Accessibility**: Include `.accessibilityLabel()` and `.accessibilityHint()` modifiers
|
|
247
|
+
5. **Use Safe Areas**: Respect `safeAreaInset` and avoid hardcoded padding at screen edges
|
|
248
|
+
6. **Implement State Restoration**: Use `@SceneStorage` for preserving user state
|
|
249
|
+
7. **Support iPad Multitasking**: Design for split view and slide over
|
|
250
|
+
8. **Test on Device**: Simulator doesn't capture full haptic and performance experience
|
|
251
|
+
|
|
252
|
+
## Common Issues
|
|
253
|
+
|
|
254
|
+
- **Layout Breaking**: Use `.fixedSize()` sparingly; prefer flexible layouts
|
|
255
|
+
- **Performance Issues**: Use `LazyVStack`/`LazyHStack` for long scrolling lists
|
|
256
|
+
- **Navigation Bugs**: Ensure `NavigationLink` values are `Hashable`
|
|
257
|
+
- **Dark Mode Problems**: Avoid hardcoded colors; use semantic or asset catalog colors
|
|
258
|
+
- **Accessibility Failures**: Test with VoiceOver enabled
|
|
259
|
+
- **Memory Leaks**: Watch for strong reference cycles in closures
|
|
260
|
+
|
|
261
|
+
## Resources
|
|
262
|
+
|
|
263
|
+
- [Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/)
|
|
264
|
+
- [SwiftUI Documentation](https://developer.apple.com/documentation/swiftui)
|
|
265
|
+
- [SF Symbols App](https://developer.apple.com/sf-symbols/)
|
|
266
|
+
- [WWDC SwiftUI Sessions](https://developer.apple.com/videos/swiftui/)
|