Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28461] iOS: Support running LiveView with Hyperloop

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2021-07-28T15:07:40.000+0000
Affected Version/sn/a
Fix Version/sRelease 10.0.1
ComponentsiOS
Labelsbuild, hyperloop, iOS, liveview
ReporterJoshua Quick
AssigneeJoshua Quick
Created2021-05-28T23:15:32.000+0000
Updated2021-07-28T15:07:40.000+0000

Description

*Summary:* Running an iOS app with LiveView will cause runtime exceptions when modifying a JS file using hyperloop. _(This works on Android as of Titanium 9.0.0 and we'd like to do the same on iOS.)_ *Cause:* While the app is being built, hyperloop will string replace all require/import calls which reference a native Objective-C/Swift type with the hyperloop JS file which wraps that native type. This works fine for normal builds since the modified JS file is written to the app bundle. But this require/import string replacement does not happen with LiveView, causing the module lookup to fail. *Recommended Solution:* Modify the hyperloop build hook to not modify the JS source files anymore. Instead, create a bootstrap script (which is ran before the "app.js") that defines the require/import bindings between native types to the actual hyperloop JS file. The below is how Android handles it. [generate-sources-task.js](https://github.com/appcelerator/hyperloop.next/blob/f98983db8aa19b73e2ec5458e04589cda900af2e/android/hooks/tasks/generate-sources-task.js#L208-L235) *Limitations:* Do the following while LiveView is running still won't be supported. The below requires a native rebuild to integrate them into the app. * Adding libraries. * Adding Hyperloop.defineClass() method calls. _(Involves native code generation.)_

Comments

  1. Joshua Quick 2021-05-29

    PR (hyperloop.next): https://github.com/appcelerator/hyperloop.next/pull/351 Also below PR fixes regression in above PR... PR (hyperloop.next): https://github.com/appcelerator/hyperloop.next/pull/355
  2. Joshua Quick 2021-06-17

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/12905

JSON Source