@craft-native/ios 0.0.90 → 0.0.92
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/README.md +47 -7
- package/package.json +3 -2
- package/templates/CraftApp.swift +706 -92
- package/templates/CraftWatchApp.swift.template +8 -0
- package/templates/WatchApp.Info.plist.template +2 -0
- package/templates/WatchExtension.Info.plist.template +34 -0
- package/templates/project.yml.template +10 -4
package/README.md
CHANGED
|
@@ -143,6 +143,11 @@ Edit `craft.config.json` in your iOS project:
|
|
|
143
143
|
}
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
+
When push notifications are enabled, generated Debug builds use the APNs
|
|
147
|
+
development environment and Release builds use the production environment.
|
|
148
|
+
The generated entitlements select the correct value from the active Xcode
|
|
149
|
+
build configuration automatically.
|
|
150
|
+
|
|
146
151
|
## JavaScript Bridge
|
|
147
152
|
|
|
148
153
|
Once Craft is initialized, the `window.craft` object is available:
|
|
@@ -154,14 +159,17 @@ window.addEventListener('craftReady', (e) => {
|
|
|
154
159
|
console.log('Capabilities:', e.detail.capabilities);
|
|
155
160
|
});
|
|
156
161
|
|
|
157
|
-
// Haptic feedback
|
|
158
|
-
|
|
159
|
-
window.craft.haptic('
|
|
160
|
-
window.craft.haptic('
|
|
162
|
+
// Haptic feedback. Resolves true, and rejects with CAPABILITY_DISABLED when
|
|
163
|
+
// enableHaptics is off.
|
|
164
|
+
await window.craft.haptic('light'); // light, medium, heavy
|
|
165
|
+
await window.craft.haptic('success'); // success, warning, error
|
|
166
|
+
await window.craft.haptic('selection');
|
|
161
167
|
|
|
162
|
-
// Speech recognition
|
|
163
|
-
|
|
164
|
-
|
|
168
|
+
// Speech recognition. startListening resolves true once the request is
|
|
169
|
+
// taken; whether listening actually began arrives as the events below
|
|
170
|
+
// (craftSpeechError for a declined prompt or no recognizer).
|
|
171
|
+
await window.craft.startListening();
|
|
172
|
+
await window.craft.stopListening();
|
|
165
173
|
|
|
166
174
|
// Listen for speech events
|
|
167
175
|
window.addEventListener('craftSpeechStart', () => { /* recording started */ });
|
|
@@ -586,6 +594,14 @@ Add to your Info.plist as needed:
|
|
|
586
594
|
<string>This app accesses your calendar.</string>
|
|
587
595
|
```
|
|
588
596
|
|
|
597
|
+
## Runtime Validation
|
|
598
|
+
|
|
599
|
+
The Zig-native bridge rejects malformed values and overlapping interactive
|
|
600
|
+
requests that the legacy Swift dispatcher could silently truncate, coerce, or
|
|
601
|
+
abandon. See the
|
|
602
|
+
[mobile runtime compatibility guide](../../docs/api/mobile/runtime-compatibility.md)
|
|
603
|
+
for the affected input classes and migration guidance.
|
|
604
|
+
|
|
589
605
|
## Development Mode
|
|
590
606
|
|
|
591
607
|
For hot-reload during development:
|
|
@@ -601,6 +617,30 @@ craft ios open
|
|
|
601
617
|
|
|
602
618
|
The app will load from your dev server instead of bundled HTML.
|
|
603
619
|
|
|
620
|
+
## Template compiler gate
|
|
621
|
+
|
|
622
|
+
On macOS with Xcode and XcodeGen installed, run `bun run test:templates` from
|
|
623
|
+
`packages/ios`. It generates a minimal app, a capability-heavy iOS app, and the
|
|
624
|
+
same capability-heavy app with a Watch companion. It builds iOS, Live Activity,
|
|
625
|
+
Watch extension, and Watch app targets against device SDKs with code signing
|
|
626
|
+
disabled.
|
|
627
|
+
|
|
628
|
+
The Watch-enabled app is also built the way Xcode builds it for a person, with
|
|
629
|
+
the Watch app embedded. The script checks that the bundle carries
|
|
630
|
+
`Watch/<App>Watch.app` with `WKWatchKitApp` and its WatchKit extension, then
|
|
631
|
+
installs the app on an iOS simulator. That needs a watchOS simulator runtime
|
|
632
|
+
matching the selected Xcode (`xcodebuild -downloadPlatform watchOS`), and the
|
|
633
|
+
script fails without one rather than skipping.
|
|
634
|
+
|
|
635
|
+
Finally, a push-enabled app is built for the simulator in Debug and Release with
|
|
636
|
+
ad-hoc signing. The script reads the `aps-environment` Xcode actually signed
|
|
637
|
+
into each: `development` for Debug, `production` for Release.
|
|
638
|
+
|
|
639
|
+
This checks the actual generated Swift and Xcode projects; `bun test` checks the
|
|
640
|
+
builder's behavior separately.
|
|
641
|
+
Temporary projects are removed after the run. Pass `--keep` to retain them for
|
|
642
|
+
debugging.
|
|
643
|
+
|
|
604
644
|
## Publishing
|
|
605
645
|
|
|
606
646
|
Build for App Store:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@craft-native/ios",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.92",
|
|
4
4
|
"homepage": "https://github.com/craft-native/craft/tree/main/packages/ios#readme",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "bun build.ts",
|
|
26
|
-
"dev": "bun --watch src/cli.ts"
|
|
26
|
+
"dev": "bun --watch src/cli.ts",
|
|
27
|
+
"test:templates": "bun scripts/compile-templates.ts"
|
|
27
28
|
},
|
|
28
29
|
"files": [
|
|
29
30
|
"dist",
|