{"id":31939654,"url":"https://github.com/alibaba/virtualview-ios","last_synced_at":"2025-10-14T08:44:36.420Z","repository":{"id":54304930,"uuid":"113382239","full_name":"alibaba/VirtualView-iOS","owner":"alibaba","description":"A solution to create \u0026 release UI component dynamically.","archived":false,"fork":false,"pushed_at":"2021-02-25T09:50:59.000Z","size":1528,"stargazers_count":507,"open_issues_count":9,"forks_count":77,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-09-27T00:10:37.941Z","etag":null,"topics":["dynamic-component","ios","tangram","virtualview"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alibaba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-07T00:24:12.000Z","updated_at":"2025-09-12T12:47:01.000Z","dependencies_parsed_at":"2022-08-13T11:30:57.858Z","dependency_job_id":null,"html_url":"https://github.com/alibaba/VirtualView-iOS","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/alibaba/VirtualView-iOS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2FVirtualView-iOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2FVirtualView-iOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2FVirtualView-iOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2FVirtualView-iOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alibaba","download_url":"https://codeload.github.com/alibaba/VirtualView-iOS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2FVirtualView-iOS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018302,"owners_count":26086345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dynamic-component","ios","tangram","virtualview"],"created_at":"2025-10-14T08:44:34.718Z","updated_at":"2025-10-14T08:44:36.412Z","avatar_url":"https://github.com/alibaba.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CocoaPods](https://img.shields.io/cocoapods/v/VirtualView.svg)]() [![CocoaPods](https://img.shields.io/cocoapods/p/VirtualView.svg)]() [![CocoaPods](https://img.shields.io/cocoapods/l/VirtualView.svg)]()\n\n# VirtualView \n\nA solution to create \u0026 release UI component dynamically.\n\nIt a part of our [Tangram](https://github.com/alibaba/Tangram-iOS) solution. And it can be used as a standalone library.\n\n这是一个动态化创建和发布 UI 组件的方案。\n\n它是我们 [Tangram](https://github.com/alibaba/Tangram-iOS) 方案的一部分。当然它也可以独立使用。\n\n中文介绍：[VirtualView iOS](http://pingguohe.net/2018/02/23/virtualview-ios-1.2.html)\n\n中文文档：[VirtualView通用文档](http://tangram.pingguohe.net/docs/virtualview/about-virtualview)，[VirtualView iOS文档](http://tangram.pingguohe.net/docs/ios/use-virtualview)\n\n## Features\n\n![feature](https://github.com/alibaba/VirtualView-iOS/raw/master/README/feature.png)\n\n1. Write component via XML.\n2. Compile XML to a .out (binary) file.\n3. Load .out file in iOS application.\n4. Create component from loaded template and bind data to it.\n5. Show the component.\n\n简单总结起来就是用 XML 描述一个组件，用我们提供的工具编译成 .out 二进制文件，在集成了 VirtualView 的 App 里直接加载 .out 文件就可以得到一个组件，然后像使用普通 UIView 一样使用它就好了。\n\n## Install\n\n### CocoaPods\n\nUse VirtualView alone:\n\n    pod 'VirtualView'\n\nUse VirtualView with [Tangram](https://github.com/alibaba/Tangram-iOS):\n\n    pod 'Tangram'\n\nCocoaPods will install VirtualView as a part of Tangram 2.x.\n\n### Source codes\n\nOr you can download source codes from [releases page](https://github.com/alibaba/VirtualView-iOS/releases) and put them into your project.\n\n## How to use\n\n1. Load component template from .out file.\n\n```objective-c\nif (![[VVTemplateManager sharedManager].loadedTypes containsObject:@\"icon_type\"]) {\n    NSString *path = [[NSBundle mainBundle] pathForResource:@\"icon_file\" ofType:@\"out\"];\n    [[VVTemplateManager sharedManager] loadTemplateFile:path forType:@\"type_alias\"];\n}\n```\n\n2. Create component.\n\n```objective-c\nself.viewContainer = [VVViewContainer viewContainerWithTemplateType:@\"icon_type\"];\n[self.view addSubview:self.viewContainer];\n```\n\n3. Bind data and calc the layout (fixed size).\n\n```objective-c\nself.viewContainer.frame = CGRectMake(0, 0, SCREEN_WIDTH, 1000);\n[self.viewContainer update:@{\n    @\"type\" : @\"icon-type\",\n    @\"imgUrl\" : @\"https://test.com/test.png\"\n}];\n```\n\n4. If you want to clac size.\n\n```objective-c\n[self.viewContainer updateData:@{\n    @\"type\" : @\"icon-type\",\n    @\"imgUrl\" : @\"https://test.com/test.png\"\n}];\nCGSize size = CGSizeMake(MAX_WIDTH, MAX_HEIGHT);\nsize = [self.viewContainer estimatedSize:size];\nself.viewContainer.frame = CGRectMake(0, 0, size.width, size.height);\n[self.viewContainer updateLayout];\n```\n\nSee more details in the demo project.\n\n## XML Compile Tools\n\nAn executable jar (need Java 1.8) is in the CompileTool path. In the demo project, we use bash script to sync XML template changes. You can find the script here:\n\n![compile_tools_script](https://github.com/alibaba/VirtualView-iOS/raw/master/README/compile_tools_script.png)\n\nSee more details [here](https://github.com/alibaba/virtualview_tools).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibaba%2Fvirtualview-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falibaba%2Fvirtualview-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibaba%2Fvirtualview-ios/lists"}