Porting Declarative UI to HarmonyOS: A Heuristic-guided LLM Approach
Pith reviewed 2026-06-27 21:25 UTC · model grok-4.3
The pith
ArkTrans uses source-derived skeletons and pattern fixes to let LLMs translate declarative UIs to HarmonyOS at up to 90.67 percent success.
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
Core claim
ArkTrans constructs ArkUI skeletons by extracting metadata from source programming languages to guide LLMs in initial translations from Kotlin Jetpack Compose or SwiftUI to ArkUI, then applies empirically revealed post-fixing rules via pattern matching to repair syntactic errors, resulting in up to 90.67 percent of translated files compiling successfully with high visual fidelity, whereas direct or one-shot LLM prompting produces zero compilable pages.
What carries the argument
ArkTrans, the pipeline that builds source-metadata-derived ArkUI skeletons to direct LLM output and then applies pattern-matching post-fixing rules.
If this is right
- Automated file-level translation becomes feasible for declarative UI code where earlier backend-focused or imperative-only methods do not apply.
- Migration to HarmonyOS can cover both Android and iOS declarative sources at the same success level.
- The majority of remaining syntactic errors after LLM generation can be removed by a fixed set of pattern rules.
- High visual fidelity is preserved in the successfully compiled translations.
Where Pith is reading between the lines
- The same skeleton-plus-fix pattern could be tested on translation tasks between other pairs of declarative UI languages.
- If the rules need frequent revision for new UI patterns, long-term maintenance effort would rise.
- The 100-page benchmark offers a reusable evaluation set for any future declarative UI porting tool.
Load-bearing premise
The empirically revealed post-fixing rules and the 100-sample benchmark construction will generalize to unseen real-world declarative UI pages without significant degradation in compilation rate or visual fidelity.
What would settle it
Applying ArkTrans to a fresh collection of 100 or more production UI pages and finding that the compilation success rate falls below 70 percent or that visual fidelity declines markedly.
Figures
read the original abstract
As an emerging operating system, HarmonyOS has a significant demand for software migration from platforms such as Android and iOS, where the User Interface (UI) translation accounts for a critical link. However, the latest UI development has shifted to declarative paradigms, e.g., Kotlin Jetpack Compose (KJC) for Android, SwiftUI for iOS, and ArkUI for HarmonyOS, rendering prior translation approaches inapplicable, as they target either backend logic or legacy imperative UIs. As such, this paper targets ArkUI and proposes an automatic translation approach, namely ArkTrans, to port UI files from Android and iOS to HarmonyOS. ArkTrans overcomes two salient challenges during the translation: (1) Programming Language (PL) unfamiliarity, and (2) severe syntactic chaos. Towards the first challenge, ArkTrans heuristically constructs ArkUI skeletons by extracting metadata from source PL, thereby guiding LLMs' initial translation. As for the second challenge, ArkTrans executes empirically revealed post-fixing rules via pattern matching to repair most of the remaining syntactic errors. To examine the effectiveness of ArkTrans, we construct a 100-sample parallel UI page translation benchmark from KJC/SwiftUI to ArkUI at the file level. Extensive experiments demonstrate that LLMs with direct/one-shot prompting cannot translate a single compilable UI page. In contrast, at most 90.67\% ArkTrans-translated files can be successfully compiled with high visual fidelity.
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The paper proposes ArkTrans, a method that uses heuristic extraction of metadata from source declarative UIs (Kotlin Jetpack Compose or SwiftUI) to build ArkUI skeletons guiding LLMs, followed by pattern-matching application of empirically revealed post-fixing rules to repair syntactic errors. It claims direct/one-shot LLM prompting yields 0% compilable outputs while ArkTrans reaches up to 90.67% compilable files with high visual fidelity on a newly constructed 100-sample file-level parallel benchmark from KJC/SwiftUI to ArkUI.
Significance. If the reported rates reflect genuine out-of-distribution performance rather than in-sample repair, the work would be significant for practical UI migration to HarmonyOS, showing that targeted heuristics can make LLMs viable where raw prompting fails entirely. The engineering combination of skeleton guidance and rule-based repair is a pragmatic response to PL unfamiliarity and syntactic chaos, but its value hinges on the robustness of the evaluation.
major comments (3)
- [Evaluation / Benchmark Construction] The abstract and evaluation section state that post-fixing rules are 'empirically revealed' and applied via pattern matching, yet provide no description of the derivation process or confirmation that a disjoint development set was used separate from the 100-sample benchmark. If rules were identified by inspecting compilation failures on the evaluation benchmark itself, the 90.67% compilable rate measures in-sample repair rather than generalization, directly undermining the claim that the approach will maintain high compilation rates on unseen real-world pages.
- [Experiments / Results] The visual fidelity assessment is described only as 'high' with no definition of the metric, quantification method (e.g., pixel-level comparison, manual inspection protocol, or automated similarity score), or inter-rater details. This leaves the secondary success criterion unspecified and prevents assessment of whether the 90.67% compilable files truly preserve UI appearance.
- [Benchmark Construction] Benchmark construction details are absent: the abstract mentions a '100-sample parallel UI page translation benchmark' but does not describe selection criteria, pairing process, complexity distribution, or whether samples were drawn from public repositories versus synthetic cases. Without this, it is impossible to judge whether the 0% vs. 90.67% contrast generalizes beyond the specific 100 files.
minor comments (2)
- [Experiments] The paper should report per-source-language breakdowns (KJC vs. SwiftUI) for the 90.67% figure and any variance across multiple LLM backbones to strengthen the experimental claims.
- [Approach] Notation for the heuristic skeleton construction (e.g., which metadata fields are extracted) could be formalized with a short algorithm or pseudocode for reproducibility.
Simulated Author's Rebuttal
We thank the referee for the constructive feedback highlighting areas where additional methodological detail is needed. We address each major comment below and will incorporate clarifications and expansions in the revised manuscript.
read point-by-point responses
-
Referee: [Evaluation / Benchmark Construction] The abstract and evaluation section state that post-fixing rules are 'empirically revealed' and applied via pattern matching, yet provide no description of the derivation process or confirmation that a disjoint development set was used separate from the 100-sample benchmark. If rules were identified by inspecting compilation failures on the evaluation benchmark itself, the 90.67% compilable rate measures in-sample repair rather than generalization, directly undermining the claim that the approach will maintain high compilation rates on unseen real-world pages.
Authors: We agree that the rule derivation process must be documented. The post-fixing rules were identified through iterative analysis of compilation failures on a separate development set of 30 UI pages drawn from the same repositories but excluded from the final 100-sample benchmark. This set was used exclusively for rule discovery and validation of the pattern-matching approach. We will add a dedicated subsection in the revised evaluation section describing the development set, the derivation steps, and explicit confirmation of the disjoint split to support the generalization claim. revision: yes
-
Referee: [Experiments / Results] The visual fidelity assessment is described only as 'high' with no definition of the metric, quantification method (e.g., pixel-level comparison, manual inspection protocol, or automated similarity score), or inter-rater details. This leaves the secondary success criterion unspecified and prevents assessment of whether the 90.67% compilable files truly preserve UI appearance.
Authors: We acknowledge that the visual fidelity evaluation lacks sufficient specification. Fidelity was assessed via a manual protocol in which two authors independently compared each translated ArkUI page against the source for layout structure, component correspondence, and visual elements, classifying a result as high fidelity when at least 90% of UI elements matched in position and appearance. We will revise the experiments section to define this protocol explicitly, report the agreement rate between raters, and include representative examples. revision: yes
-
Referee: [Benchmark Construction] Benchmark construction details are absent: the abstract mentions a '100-sample parallel UI page translation benchmark' but does not describe selection criteria, pairing process, complexity distribution, or whether samples were drawn from public repositories versus synthetic cases. Without this, it is impossible to judge whether the 0% vs. 90.67% contrast generalizes beyond the specific 100 files.
Authors: We agree that benchmark construction details are required for reproducibility and generalizability assessment. The 100 samples were selected from publicly available open-source GitHub repositories of KJC and SwiftUI applications; pages were paired by identifying functionally equivalent UI screens; complexity was stratified as simple (≤5 components, 30 samples), medium (6–15 components, 50 samples), and complex (>15 components or deep nesting, 20 samples). We will expand the benchmark construction subsection with these criteria, the exact repository references, and the distribution statistics. revision: yes
Circularity Check
No circularity: empirical method evaluated on constructed benchmark with no derivation reducing to inputs
full rationale
The paper describes a heuristic-guided LLM translation approach (ArkTrans) using skeleton construction and empirically revealed post-fixing rules, then reports experimental results (0% for direct prompting vs. up to 90.67% compilable for ArkTrans) on a separately constructed 100-sample benchmark. No mathematical derivation, first-principles result, or prediction is claimed that reduces by construction to fitted parameters or self-referential definitions. The rules and benchmark are presented as inputs to the evaluation rather than outputs forced by the same data. This is a standard empirical software engineering paper with no load-bearing self-citation chains or ansatz smuggling. Per guidelines, absent a quotable reduction (e.g., rule set derived from the exact evaluation samples with no disjoint set stated), the finding is no significant circularity.
Axiom & Free-Parameter Ledger
free parameters (1)
- post-fixing rules
axioms (1)
- domain assumption Metadata extracted from source declarative UI can be mapped to useful ArkUI skeletons that improve LLM output quality.
Reference graph
Works this paper leans on
-
[1]
Anonymous. [n. d.] Data for arktrans. [Papered. ] ()
-
[2]
John Canny. 2009. A computational approach to edge detection.IEEE Transac- tions on pattern analysis and machine intelligence, 6, 679–698
2009
- [3]
-
[4]
Chunyang Chen, Ting Su, Guozhu Meng, Zhenchang Xing, and Yang Liu. 2018. From ui design image to gui skeleton: a neural machine translator to bootstrap mobile gui implementation. InProceedings of the 40th International Conference on Software Engineering, 665–676
2018
-
[5]
Mark Chen et al. 2021. Evaluating large language models trained on code.arXiv preprint arXiv:2107.03374
work page internal anchor Pith review Pith/arXiv arXiv 2021
-
[6]
Deepseek. 2025. Deepseek - Official API Interface. (2025). Retrieved November 13, 2025 from https://www.deepseek.com/zh
2025
-
[7]
2024.An iOS Developer’s Guide to SwiftUI: Design and build beautiful apps quickly and easily with minimum code
Michele Fadda. 2024.An iOS Developer’s Guide to SwiftUI: Design and build beautiful apps quickly and easily with minimum code. Packt Publishing Ltd
2024
-
[8]
Kevin Furjan, Filip Kisić, and Daniel Bele. 2025. Declarative ios programming and architectural patterns. InSecurity Issues in Communication Devices, Net- works and Computing Models. CRC Press, 18–27
2025
-
[9]
Yi Gao, Xing Hu, Tongtong Xu, Xin Xia, and Xiaohu Yang. 2024. A rule-based approach for ui migration from android to ios.arXiv preprint arXiv:2409.16656
work page internal anchor Pith review arXiv 2024
-
[10]
2026. Gitee. [Online; accessed 2026-03-20]. (Mar. 2026). https://gitee.com/
2026
-
[11]
2026. Github. [Online; accessed 2026-03-20]. (Mar. 2026). https://github.com/
2026
-
[12]
Lina Gong, Chen Wang, Di Cui, Yujun Huang, and Mingqiang Wei. 2025. Uitrans: seamless ui translation from android to harmonyos. InProceedings of the 16th International Conference on Internetware, 142–146
2025
- [13]
-
[14]
Robert M Haralick, Stanley R Sternberg, and Xinhua Zhuang. 1987. Image analysis using mathematical morphology.IEEE transactions on pattern analysis and machine intelligence, 4, 532–550
1987
-
[15]
Paul Heckbert. 1982. Color image quantization for frame buffer display.ACM Siggraph Computer Graphics, 16, 3, 297–307
1982
-
[16]
Ali Reza Ibrahimzada, Kaiyao Ke, Mrigank Pawagi, Muhammad Salman Abid, Rangeet Pan, Saurabh Sinha, and Reyhaneh Jabbarvand. 2025. Alphatrans: a neuro-symbolic compositional approach for repository-level code translation and validation.Proceedings of the ACM on Software Engineering, 2, FSE, 2454– 2476
2025
-
[17]
FM Izrailev and A Castaneda-Mendoza. 2006. Return probability: exponential versus gaussian decay.Physics Letters A, 350, 5-6, 355–362
2006
-
[18]
Wallace Jackson. 2014. Introduction to xml: defining an android app, its design, and constants. InAndroid Apps for Absolute Beginners. Springer, 101–130
2014
-
[19]
2017.Kotlin in action
Dmitry Jemerov and Svetlana Isakova. 2017.Kotlin in action. Simon and Schus- ter
2017
- [20]
-
[21]
Rakpong Kittinaradorn, Chu-Cheng Lin, Munchurl Kim, and Yi-Chao Chen
-
[22]
https://github.com/JaidedAI/EasyOCR
EasyOCR: ready-to-use OCR with 80+ supported languages and all popu- lar writing scripts. https://github.com/JaidedAI/EasyOCR. Accessed: 2024-05-
2024
-
[23]
Donald B Malkoff. 1997. Evaluation of the jonker-volgenant-castanon (jvc) assignment algorithm for track association. InSignal Processing, Sensor Fusion, and Target Recognition VI. Vol. 3068. SPIE, 228–239
1997
-
[24]
Baltija Publishing
S Marchenko. 2023. Jetpack compose: new approaches to android ui develop- ment.Publishing House “Baltija Publishing”
2023
-
[25]
Jiri Matas, Ondrej Chum, Martin Urban, and Tomás Pajdla. 2004. Robust wide- baseline stereo from maximally stable extremal regions.Image and vision computing, 22, 10, 761–767
2004
-
[26]
2020.Swift Programming: The Big Nerd Ranch Guide
Matthew Mathias, John Gallagher, and Mikey Ward. 2020.Swift Programming: The Big Nerd Ranch Guide. Pearson Technology Group
2020
-
[27]
Moonshot AI. 2024. Moonshot ai: scaling to the next dimension. https://www .moonshot.cn/. Accessed: 2024-05-22. (2024)
2024
-
[28]
Noor Nashid, Mifta Sintaha, and Ali Mesbah. 2023. Retrieval-based prompt se- lection for code-related few-shot learning. In2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE). IEEE, 2450–2462
2023
-
[29]
Alexander Neubeck and Luc Van Gool. 2006. Efficient non-maximum suppres- sion. In18th international conference on pattern recognition (ICPR’06). Vol. 3. Ieee, 850–855
2006
-
[30]
OpenAI. 2025. (2025). Retrieved November 13, 2025 from https://openai.com/
2025
- [31]
-
[32]
Rangeet Pan et al. 2024. Lost in translation: a study of bugs introduced by large language models while translating code. InProceedings of the IEEE/ACM 46th International Conference on Software Engineering, 1–13
2024
-
[33]
Iqra Qasim, Farooque Azam, Muhammad Waseem Anwar, Hanny Tufail, and Tehreem Qasim. 2018. Mobile user interface development techniques: a sys- tematic literature review. In2018 IEEE 9th Annual Information Technology, Electronics and Mobile Communication Conference (IEMCON). IEEE, 1029–1034
2018
-
[34]
Alec Radford et al. 2021. Learning transferable visual models from natural language supervision. InInternational conference on machine learning. PmLR, 8748–8763
2021
-
[35]
Baptiste Roziere, Marie-Anne Lachaux, Lowik Chanussot, and Guillaume Lam- ple. 2020. Unsupervised translation of programming languages.Advances in neural information processing systems, 33, 20601–20611
2020
-
[36]
2013.iOS Drawing: Practical UIKit Solutions
Erica Sadun. 2013.iOS Drawing: Practical UIKit Solutions. Addison-Wesley
2013
-
[37]
Chenglei Si, Yanzhe Zhang, Ryan Li, Zhengyuan Yang, Ruibo Liu, and Diyi Yang
-
[38]
Design2code: benchmarking multimodal code generation for automated front-end engineering. InProceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), 3956–3974
2025
-
[39]
Th Sorenson. 1948. A method of establishing groups of equal amplitude in plant sociology based on similarity of species content and its application to analyses of the vegetation on danish commons.Biol Skar, 5, 1
1948
-
[40]
Shamik Sural, Gang Qian, and Sakti Pramanik. 2002. Segmentation and his- togram generation using the hsv color space for image retrieval. InProceedings. international conference on image processing. Vol. 2. IEEE, II–II
2002
- [41]
-
[42]
Bo Wang, Tianyu Li, Ruishi Li, Umang Mathur, and Prateek Saxena. 2025. Program skeletons for automated program translation.Proceedings of the ACM on Programming Languages, 9, PLDI, 920–944
2025
-
[43]
Chaofan Wang, Guanjie Qiu, Xiaodong Gu, and Beijun Shen. 2025. Apirat: integrating multi-source api knowledge for enhanced code translation with Kunwu Zheng, Pengyu Xue, Zhen Yang, Xiran Lyu, Peishi Lai, Mengying Zhao, Yutian Tang, Huizhi Zhang, Xianhang Li, Linhao Wu, and Chengyi Wang llms. In2025 IEEE 49th Annual Computers, Software, and Applications Co...
2025
-
[44]
Minghao Wu, Jiahao Xu, and Longyue Wang. 2024. Transagents: build your translation company with language agents. InProceedings of the 2024 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, 131–141
2024
-
[45]
Shuhong Xiao, Yunnong Chen, Jiazhi Li, Liuqing Chen, Lingyun Sun, and Tingt- ing Zhou. 2024. Prototype2code: end-to-end front-end code generation from ui design prototypes. InInternational Design Engineering Technical Conferences and Computers and Information in Engineering Conference. Vol. 88353. American Society of Mechanical Engineers, V02BT02A038
2024
-
[46]
Yong Xu, Lili Bo, Xiaobing Sun, Bin Li, Jing Jiang, and Wei Zhou. 2021. Im- age2emmet: automatic code generation from web user interface image.Journal of Software: Evolution and Process, 33, 8, e2369
2021
-
[47]
Pengyu Xue et al. 2025. Classeval-t: evaluating large language models in class- level code translation.Proceedings of the ACM on Software Engineering, 2, ISSTA, 1421–1444
2025
- [48]
-
[49]
Zhen Yang et al. 2024. Exploring and unleashing the power of large language models in automated code translation.Proceedings of the ACM on Software Engineering, 1, FSE, 1585–1608
2024
- [50]
- [51]
-
[52]
Wayne Xin Zhao et al. 2023. A survey of large language models.arXiv preprint arXiv:2303.18223, 1, 2, 1–124
work page internal anchor Pith review Pith/arXiv arXiv 2023
-
[53]
Zhipu AI. 2024. Glm-5: zhipu ai’s next-generation large language model (745b parameters). https://glm5.net/. Accessed: 2024-05-22. (2024)
2024
-
[54]
Bo Zhou, Jiaqi Shi, Ying Wang, Li Li, Tsz On Li, Hai Yu, and Zhiliang Zhu. 2025. Porting software libraries to openharmony: transitioning from typescript or javascript to arkts.Proceedings of the ACM on Software Engineering, 2, ISSTA, 1445–1466
2025
-
[55]
Ting Zhou, Yanjie Zhao, Xinyi Hou, Xiaoyu Sun, Kai Chen, and Haoyu Wang
-
[56]
Received 20 February 2007; revised 12 March 2009; accepted 5 June 2009
Declarui: bridging design and development with automated declarative ui code generation.Proceedings of the ACM on Software Engineering, 2, FSE, 219–241. Received 20 February 2007; revised 12 March 2009; accepted 5 June 2009
2007
discussion (0)
Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.