Automated Source Code Transformation service
This repository contains the Android and iOS source code for projets used to demonstrate the Assets Transformation service from RefelectCode.
Using this service the assets files in \Android\res
are converted into asset catalog files for Xcode in \AssetDemo\Assets.xcassets
folder.
- Image assets from mdpi, hdpi, xhdpi and xxhdpi are mapped to 1x, 2x and 3x images
- For .9.png files, slicing information is added for asset in catalog
- Vector image xml are converted into
.pdf
files for use in Storyboard - Vector image xml are also transformed into Swift code and for each vector file a static method is added in
VectorStore.swift
This sample project demonstrates conversion of following files -
- .png
- .9.png
- color.xml
- MipMap images
- Vector xml
- Shape xml
- Anim xml
File Type | Location | Usage |
---|---|---|
.png, .9.png, color and MipMap | Asset Catalog | In storyboard - Directly accessed in attribute inspector pane In code - Use UIImage(named: "MyImage") |
Vector / Shape xml | Asset Catalog | In storyboard - Directly accessed in attribute inspector pane In code - Use UIImage(named: "MyImage") |
Vector or Shape xml | VectorStore.swift | In code - Use imgView!.layer.addSublayer(VectorStore.ic_launcher_foreground(viewBounds: imgView!.bounds)) |
Anim xml | RC_AnimationStore.swift | In code - Use imgView?.layer.add( anim!, forKey: "bounse") |
File Type | Estimate |
---|---|
png or .jpg | 5 stm for image + 10 stm for 'Contents.json' |
9.png | 5 stm for image + 20 for 'Contents.json' with slicing data |
color.xml | 10 stm for each color value ".colorset" |
MipMap images | 5 stm for each .jpg or .png |
Shape xml | PDF file : stm = count of "android:" attribute in source xml + 10 stm for 'Contents.json' |
Vector xml | PDF file : stm = count of "android:" attribute in source xml + 10 stm for 'Contents.json' Swift code = LOC of Swift code generated for the file |
Anim xml | Swift code = LOC of Swift code generated for the file |
Screen shot of Android and iOS devices showing usage of various assets -
Android Studio layout editor.
Xcode Storyboard editor.
Android Studio image assets.
Xcode Asset Catalog showing mapping of 1x, 2x and 3x assets.
Android Studio .9.PNG image assets editor.
Xcode AssetCatalog with slicing information extracted from .9.png file Estimation : 25 stm for each imageset in asset catalog.
Screen shot of Android and iOS devices showing usage of various vector xml.
Showing CAShapeLayer
returned by func heart_vector()
generated from heart_vector.xml
android vector file
UI with FingerPrint vector xml from material.io
Shape xml file comparison
Screen shot of Android and iOS devices for animation demo project
Android Screen Rec | iOS Screen Rec |
---|---|
![]() |
![]() |
Note : the GIF files are not in sync, but animation in actual app are in sync and takes same duration
Anim_Android
contains the Android demo project for AnimationAnim_iOS
contains the iOS demo project for AnimationAsset_Android
contains the Android source demo projectAsset_iOS
contains the ported Xcode projectVector_Android
contains Android demo project for vector xmlVector_iOS
contains Xcode demo project for vector filesVisuals
contains images
This project is made available under the MIT license. See the LICENSE file for more details.