@buivietphi/skill-mobile-mt 2.0.0

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.
@@ -0,0 +1,244 @@
1
+ # Platform Excellence — iOS vs Android Guidelines
2
+
3
+ > Not one-size-fits-all. Follow native platform guidelines.
4
+
5
+ ## Philosophy
6
+
7
+ ❌ **BAD**: Same UI for both platforms
8
+ ✅ **GOOD**: Platform-specific UI, shared business logic
9
+ 🎯 **TARGET**: >80% code sharing, 100% platform-native UX
10
+
11
+ ---
12
+
13
+ ## iOS 18+ Guidelines
14
+
15
+ ### Navigation
16
+ - Use NavigationStack, not legacy NavigationView
17
+ - Tab bar at bottom, always visible
18
+ - Back button top-left, standard chevron
19
+ - Swipe from left edge to go back
20
+
21
+ ### Interactions
22
+ - Haptic feedback for important actions
23
+ - 3D Touch / Haptic Touch context menus
24
+ - Swipe actions (leading/trailing)
25
+ - Pull-to-refresh standard
26
+
27
+ ### Typography
28
+ - SF Pro (system font)
29
+ - Dynamic Type support (accessibility)
30
+ - Hierarchy: Large Title > Title > Headline > Body
31
+
32
+ ### Colors
33
+ - Support Light + Dark mode
34
+ - Use semantic colors (not hardcoded)
35
+ - Respect user's appearance preference
36
+
37
+ ---
38
+
39
+ ## Android 15+ / Material 3
40
+
41
+ ### Navigation
42
+ - Navigation drawer from left
43
+ - Bottom navigation (3-5 items)
44
+ - Back button (system or top-left arrow)
45
+ - Floating Action Button (FAB) for primary action
46
+
47
+ ### Interactions
48
+ - Ripple effect on touch
49
+ - Material You (dynamic colors from wallpaper)
50
+ - Long-press for context menu
51
+ - Swipe-to-dismiss (lists, cards)
52
+
53
+ ### Typography
54
+ - Roboto (system font)
55
+ - Material Type Scale: Display > Headline > Title > Body
56
+
57
+ ### Colors
58
+ - Material 3 color system (primary, secondary, tertiary)
59
+ - Support Light + Dark theme
60
+ - Dynamic color (Material You)
61
+
62
+ ---
63
+
64
+ ## Performance Standards
65
+
66
+ | Metric | iOS | Android |
67
+ |--------|-----|---------|
68
+ | **Cold start** | < 1.0s | < 1.5s |
69
+ | **Memory baseline** | < 120MB | < 100MB |
70
+ | **FPS** | 60 (120 ProMotion) | 60 (90/120 if supported) |
71
+ | **Battery** | < 4%/hour | < 4%/hour |
72
+ | **Touch response** | < 16ms | < 16ms |
73
+
74
+ ---
75
+
76
+ ## Platform-Specific Features
77
+
78
+ ### iOS Only
79
+ - Face ID / Touch ID (biometrics)
80
+ - HealthKit (health data)
81
+ - Apple Pay
82
+ - SiriKit (voice)
83
+ - WidgetKit (home screen widgets)
84
+ - Live Activities (Dynamic Island)
85
+
86
+ ### Android Only
87
+ - Google Pay
88
+ - Widgets (home screen, lock screen)
89
+ - Background services (more flexible)
90
+ - File system access
91
+ - USB/Bluetooth flexibility
92
+
93
+ ---
94
+
95
+ ## Code Sharing Strategy
96
+
97
+ ```
98
+ SHARE (Business Logic):
99
+ ├── API calls
100
+ ├── Data models
101
+ ├── State management
102
+ ├── Business rules
103
+ └── Validation logic
104
+
105
+ PLATFORM-SPECIFIC (UI):
106
+ ├── Navigation patterns
107
+ ├── Gesture handling
108
+ ├── Platform components
109
+ └── Platform animations
110
+ ```
111
+
112
+ Example (React Native):
113
+ ```typescript
114
+ // Shared: business logic
115
+ export const useAuth = () => {
116
+ const login = async (email, password) => { ... } // Shared
117
+ return { login }
118
+ }
119
+
120
+ // Platform-specific: UI
121
+ import { LoginScreen as IOSLogin } from './LoginScreen.ios'
122
+ import { LoginScreen as AndroidLogin } from './LoginScreen.android'
123
+
124
+ export const LoginScreen = Platform.select({
125
+ ios: IOSLogin,
126
+ android: AndroidLogin
127
+ })
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Comparison Matrix
133
+
134
+ | Feature | iOS Guideline | Android Guideline |
135
+ |---------|---------------|-------------------|
136
+ | **Back nav** | Top-left chevron | System back / top-left arrow |
137
+ | **Tab bar** | Bottom, always visible | Bottom navigation |
138
+ | **Search** | Top, expandable | Top, collapsible |
139
+ | **FAB** | Rare, use + in nav bar | Common, bottom-right |
140
+ | **Context menu** | Haptic Touch | Long-press |
141
+ | **Swipe actions** | Leading/trailing | Swipe-to-dismiss |
142
+ | **Notifications** | Banner, center | Banner, top |
143
+ | **Dark mode** | System-controlled | System-controlled |
144
+
145
+ ---
146
+
147
+ ## iOS Haptics
148
+
149
+ ```swift
150
+ // 3 feedback types — use the right one
151
+ UIImpactFeedbackGenerator(style: .medium).impactOccurred() // button tap, card flip
152
+ UINotificationFeedbackGenerator().notificationOccurred(.success) // save success / error / warning
153
+ UISelectionFeedbackGenerator().selectionChanged() // picker scroll, toggle
154
+
155
+ // ✅ Rules
156
+ // - Impact: physical interactions (drag drop, button press)
157
+ // - Notification: outcomes (success, error, warning) — max 1 per action
158
+ // - Selection: discrete value changes (picker, slider step)
159
+ // ⛔ Never chain multiple haptics in <300ms
160
+ // ⛔ Never use for routine navigation (back, tab switch)
161
+ ```
162
+
163
+ ## Permission Timing (iOS/Android)
164
+
165
+ ```
166
+ RULE: Ask ONLY when the feature needs it — not at launch
167
+
168
+ Permission When to ask
169
+ ─────────────────────────────────────────────────────
170
+ Camera User taps "Take Photo" button
171
+ Location User taps "Find Nearby" or map feature
172
+ Contacts User taps "Invite from Contacts"
173
+ Notifications After onboarding, show a pre-permission dialog first
174
+ Microphone User taps "Record Voice Note"
175
+
176
+ PRE-PERMISSION DIALOG (iOS — before system prompt):
177
+ "Get notified when teammates reply"
178
+ [Allow] [Not now]
179
+ → Only show system prompt if user taps Allow
180
+ → Saves 1 chance at permission — don't waste it at cold start
181
+ ```
182
+
183
+ ## Ratings Timing
184
+
185
+ ```
186
+ // 2-step flow — ask only after success
187
+ Step 1: "Is [App] helping you get things done?"
188
+ [Yes!] [Not really]
189
+
190
+ Step 2 (if Yes): "Mind leaving a review? It helps us a lot."
191
+ [Sure] [Maybe later]
192
+ Step 2 (if No): "What's getting in the way?" [Give feedback]
193
+
194
+ // iOS: Use SKStoreReviewController.requestReview() — max 3x/year
195
+ // Android: Use ReviewManager from Play Core library
196
+ // NEVER ask after an error, payment, or on app cold start
197
+ ```
198
+
199
+ ## Live Activities / Dynamic Island (iOS 16.1+)
200
+
201
+ ```swift
202
+ // 1. Define attributes
203
+ struct DeliveryAttributes: ActivityAttributes {
204
+ struct ContentState: Codable, Hashable {
205
+ var status: String
206
+ var eta: Date
207
+ }
208
+ var orderId: String
209
+ }
210
+
211
+ // 2. Start activity
212
+ let initialState = DeliveryAttributes.ContentState(status: "Preparing", eta: Date())
213
+ let activity = try? Activity.request(
214
+ attributes: DeliveryAttributes(orderId: "123"),
215
+ content: .init(state: initialState, staleDate: nil)
216
+ )
217
+
218
+ // 3. Update
219
+ await activity?.update(.init(state: .init(status: "Out for delivery", eta: Date()), staleDate: nil))
220
+
221
+ // 4. End
222
+ await activity?.end(dismissalPolicy: .default)
223
+ ```
224
+
225
+ ---
226
+
227
+ ## Anti-Patterns
228
+
229
+ ```
230
+ ❌ Material Design on iOS
231
+ ❌ iOS navigation on Android
232
+ ❌ Ignoring platform conventions
233
+ ❌ "Write once, look mediocre everywhere"
234
+ ❌ Asking permissions at app launch
235
+ ❌ Chaining multiple haptics back-to-back
236
+ ❌ Rating prompt right after install
237
+
238
+ ✅ Native look & feel per platform
239
+ ✅ Shared logic, platform UI
240
+ ✅ Respect platform guidelines
241
+ ✅ "Write once, look native everywhere"
242
+ ✅ Ask permissions at the moment they're needed
243
+ ✅ Rating prompts only after clear success moments
244
+ ```