<commit_before># sango
Tool for processing common app constants and assets for iOS and Android. Takes a source JSON and copies files, and outputs a Swift and Java file for use.


We have a need to share constants, and assets between iOS and Android projects. One solution that has worked well has a 3rd git depot that contains shared assets, and a source JSON file that is parsed by a tool for each platform.

Today we have basic localization that will transform and copy the standard iOS key/value strings files into what's needed to iOS and Android xml.

We may migrate to something like Twine, in the future. https://github.com/mobiata/twine.

```JSON
Basic data spec:
{
	"schemaVersion": 1,
	"java": {
		"package": "io.afero.tokui",
		"launcher_icon_name": "android_launcher_icon",
		"base": "Constants"
	},
	"swift": {
		"base": "Constants"
	},
	"locale": {
		"default": "assets/locale/en.strings",
		"de": "assets/locale/de.strings",
		"it": "assets/locale/it.strings",
		"jp": "assets/locale/jp.strings"
	},
	"fonts": [
		"assets/GT-Walsheim-Black-Oblique.ttf",
		"assets/GT-Walsheim-Black.ttf"
	],
    "appIconAndroid" : "assets/app_icons/android/release_app_icon.png",
    "appIconIos" : "assets/app_icons/ios/release_app_icon.png",
	"imagesIos": [
		"assets/account_avatar2.png"
	],
	"layoutAndroid": [
		"assets/android/activity_object_detail.xml"
	],
	"imagesAndroid": [
		"assets/account_avatar1.png"
	],
	"images": [
		"assets/ASR-1/asr_1@2x.png",
		"assets/ASR-1/asr_1@3x.png",
		"assets/splash_logo/splash_logo.png",
		"assets/splash_logo/splash_logo@2x.png",
		"assets/splash_logo/splash_logo@3x.png"
	],
	"copied": [
		"assets/file_data1",
		"assets/file_data2"
	],
	"images": [
		"assets/asr_1.png"
	],
	"imagesScaled": [
		"assets/vector_avatar.pdf",
		"assets/business_men.ai",
		"assets/green_guy.eps"
	],
	"Settings": {
		"UI_BASE_COLOR": "67,163,199,255",
		"UI_BASE_COLOR2": "67,163,199,20",
		"UI_SECONDARY_COLOR": "#431298",
		"UI_SECONDARY_COLOR_LOW": "#80431298",
		"DEFAULT_UI_FONT": "GT-Walsheim-Black.ttf",
		"DEFAULT_AVATAR": "account_avatar1",
		"PREF_ACCOUNT_NAME": "pref_account_display_name",
		"PREF_SERVICE": "pref_service_name",
		"DEFAULT_DISPLAY_UI_STYLE": 1,
		"SCALE": 1.5,
		"DEBUG_ENABLED": true,
		"SHOW_UI": false
	},
	"Empty": [""],
	"Hello": [
		"one",
		"two",
		"three"
	],
	"FloatyNumbers": [
		1, 2, 3.15, 23, 415.03
	],
	"InteryNumbers": [
		5, 23, 54, 120, 100
	],
	"RainbowColors" :[
		"#535557", "#9D9C98", "#F2845B", "#F67D4B", "#EDAC93"
	],
	"Service": {
        "TYPE": "OAUTH2",
        "BROWSE_TYPE": "CARDS",
        "MENU_VIEW": "SETTINGS",
		"BASE_URL_PROD_USW2": "api.afero.io",
		"BASE_URL_STAGE": "api.dev.afero.io"
	},
	"Colors": {
		"GRAY01_50": "#F2EDEB",
		"GRAY02_50": "#D0CBC7",
		"GRAY03_50": "#A4A099",
		"GRAY04_50": "#7E7B77",
		"ORANGE01_50": "#F67D4B",
		"WHITE01_50": "#FFFFFF",
		"GRAY01": "#E1DFDC",
		"GRAY02": "#BFBCB7",
		"GRAY03": "#9D9C98",
		"GRAY04": "#85878A",
		"GRAY05": "#717375",
		"GRAY06": "#616264",
		"GRAY07": "#535557",
		"ORANGE06": "#F67D4B",
		"ORANGE05": "#F47344",
		"ORANGE04": "#F2845B",
		"ORANGE03": "#EF9471",
		"ORANGE02": "#EBA485",
		"ORANGE01": "#EDAC93",
		"WHITE01": "#FFFFFF"
	},
    "enums": {
        "AUTH_TYPE": ["AFERO", "OAUTH2"],
        "MENU_VIEW_TYPE": ["CLASSIC", "SETTINGS"],
        "DEVICE_BROWSER_TYPE": ["HEX", "CARDS"],
        "DAY": ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"],
        "TIME_OF_DAY": ["BREAKFAST", "LUNCH", "SNACK", "DINNER"],
		"SAFE_IMAGES": ["asr_1", "ac_icon_large"]
    }
}
```


Output:
Constants.swift
```Swift
/* Generated with Sango, by Afero.io */

import UIKit
public struct Constants {
	public struct Colors {
		static let Gray01 = UIColor(red: 0.882, green: 0.875, blue: 0.863, alpha: 1.0) /* #E1DFDC */
		static let Gray01_50 = UIColor(red: 0.949, green: 0.929, blue: 0.922, alpha: 1.0) /* #F2EDEB */
		static let Gray02 = UIColor(red: 0.749, green: 0.737, blue: 0.718, alpha: 1.0) /* #BFBCB7 */
		static let Gray02_50 = UIColor(red: 0.816, green: 0.796, blue: 0.78, alpha: 1.0) /* #D0CBC7 */
		static let Gray03 = UIColor(red: 0.616, green: 0.612, blue: 0.596, alpha: 1.0) /* #9D9C98 */
		static let Gray03_50 = UIColor(red: 0.643, green: 0.627, blue: 0.6, alpha: 1.0) /* #A4A099 */
		static let Gray04 = UIColor(red: 0.522, green: 0.529, blue: 0.541, alpha: 1.0) /* #85878A */
		static let Gray04_50 = UIColor(red: 0.494, green: 0.482, blue: 0.467, alpha: 1.0) /* #7E7B77 */
		static let Gray05 = UIColor(red: 0.443, green: 0.451, blue: 0.459, alpha: 1.0) /* #717375 */
		static let Gray06 = UIColor(red: 0.38, green: 0.384, blue: 0.392, alpha: 1.0) /* #616264 */
		static let Gray07 = UIColor(red: 0.325, green: 0.333, blue: 0.341, alpha: 1.0) /* #535557 */
		static let Orange01 = UIColor(red: 0.929, green: 0.675, blue: 0.576, alpha: 1.0) /* #EDAC93 */
		static let Orange01_50 = UIColor(red: 0.965, green: 0.49, blue: 0.294, alpha: 1.0) /* #F67D4B */
		static let Orange02 = UIColor(red: 0.922, green: 0.643, blue: 0.522, alpha: 1.0) /* #EBA485 */
		static let Orange03 = UIColor(red: 0.937, green: 0.58, blue: 0.443, alpha: 1.0) /* #EF9471 */
		static let Orange04 = UIColor(red: 0.949, green: 0.518, blue: 0.357, alpha: 1.0) /* #F2845B */
		static let Orange05 = UIColor(red: 0.957, green: 0.451, blue: 0.267, alpha: 1.0) /* #F47344 */
		static let Orange06 = UIColor(red: 0.965, green: 0.49, blue: 0.294, alpha: 1.0) /* #F67D4B */
		static let White01 = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) /* #FFFFFF */
		static let White01_50 = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) /* #FFFFFF */
	}
	public let Empty = [
			""
		]
	public let FloatyNumbers = [
			1,
			2,
			3.15,
			23,
			415.03
		]
	public let Hello = [
			"one",
			"two",
			"three"
		]
	public let InteryNumbers = [
			5,
			23,
			54,
			120,
			100
		]
	public let RainbowColors = [
			UIColor(red: 0.325, green: 0.333, blue: 0.341, alpha: 1.0) /* #535557 */,
			UIColor(red: 0.616, green: 0.612, blue: 0.596, alpha: 1.0) /* #9D9C98 */,
			UIColor(red: 0.949, green: 0.518, blue: 0.357, alpha: 1.0) /* #F2845B */,
			UIColor(red: 0.965, green: 0.49, blue: 0.294, alpha: 1.0) /* #F67D4B */,
			UIColor(red: 0.929, green: 0.675, blue: 0.576, alpha: 1.0) /* #EDAC93 */
		]
	public struct Service {<commit_msg>Update README.md with new swift code results<commit_after># sango
Tool for processing common app constants and assets for iOS and Android. Takes a source JSON and copies files, and outputs a Swift and Java file for use.


We have a need to share constants, and assets between iOS and Android projects. One solution that has worked well has a 3rd git depot that contains shared assets, and a source JSON file that is parsed by a tool for each platform.

Today we have basic localization that will transform and copy the standard iOS key/value strings files into what's needed to iOS and Android xml.

We may migrate to something like Twine, in the future. https://github.com/mobiata/twine.

```JSON
Basic data spec:
{
	"schemaVersion": 1,
	"java": {
		"package": "io.afero.tokui",
		"launcher_icon_name": "android_launcher_icon",
		"base": "Constants"
	},
	"swift": {
		"base": "Constants"
	},
	"locale": {
		"default": "assets/locale/en.strings",
		"de": "assets/locale/de.strings",
		"it": "assets/locale/it.strings",
		"jp": "assets/locale/jp.strings"
	},
	"fonts": [
		"assets/GT-Walsheim-Black-Oblique.ttf",
		"assets/GT-Walsheim-Black.ttf"
	],
    "appIconAndroid" : "assets/app_icons/android/release_app_icon.png",
    "appIconIos" : "assets/app_icons/ios/release_app_icon.png",
	"imagesIos": [
		"assets/account_avatar2.png"
	],
	"layoutAndroid": [
		"assets/android/activity_object_detail.xml"
	],
	"imagesAndroid": [
		"assets/account_avatar1.png"
	],
	"images": [
		"assets/ASR-1/asr_1@2x.png",
		"assets/ASR-1/asr_1@3x.png",
		"assets/splash_logo/splash_logo.png",
		"assets/splash_logo/splash_logo@2x.png",
		"assets/splash_logo/splash_logo@3x.png"
	],
	"copied": [
		"assets/file_data1",
		"assets/file_data2"
	],
	"images": [
		"assets/asr_1.png"
	],
	"imagesScaled": [
		"assets/vector_avatar.pdf",
		"assets/business_men.ai",
		"assets/green_guy.eps"
	],
	"Settings": {
		"UI_BASE_COLOR": "67,163,199,255",
		"UI_BASE_COLOR2": "67,163,199,20",
		"UI_SECONDARY_COLOR": "#431298",
		"UI_SECONDARY_COLOR_LOW": "#80431298",
		"DEFAULT_UI_FONT": "GT-Walsheim-Black.ttf",
		"DEFAULT_AVATAR": "account_avatar1",
		"PREF_ACCOUNT_NAME": "pref_account_display_name",
		"PREF_SERVICE": "pref_service_name",
		"DEFAULT_DISPLAY_UI_STYLE": 1,
		"SCALE": 1.5,
		"DEBUG_ENABLED": true,
		"SHOW_UI": false
	},
	"Empty": [""],
	"Hello": [
		"one",
		"two",
		"three"
	],
	"FloatyNumbers": [
		1, 2, 3.15, 23, 415.03
	],
	"InteryNumbers": [
		5, 23, 54, 120, 100
	],
	"RainbowColors" :[
		"#535557", "#9D9C98", "#F2845B", "#F67D4B", "#EDAC93"
	],
	"Service": {
        "TYPE": "OAUTH2",
        "BROWSE_TYPE": "CARDS",
        "MENU_VIEW": "SETTINGS",
		"BASE_URL_PROD_USW2": "api.afero.io",
		"BASE_URL_STAGE": "api.dev.afero.io"
	},
	"Colors": {
		"GRAY01_50": "#F2EDEB",
		"GRAY02_50": "#D0CBC7",
		"GRAY03_50": "#A4A099",
		"GRAY04_50": "#7E7B77",
		"ORANGE01_50": "#F67D4B",
		"WHITE01_50": "#FFFFFF",
		"GRAY01": "#E1DFDC",
		"GRAY02": "#BFBCB7",
		"GRAY03": "#9D9C98",
		"GRAY04": "#85878A",
		"GRAY05": "#717375",
		"GRAY06": "#616264",
		"GRAY07": "#535557",
		"ORANGE06": "#F67D4B",
		"ORANGE05": "#F47344",
		"ORANGE04": "#F2845B",
		"ORANGE03": "#EF9471",
		"ORANGE02": "#EBA485",
		"ORANGE01": "#EDAC93",
		"WHITE01": "#FFFFFF"
	},
    "enums": {
        "AUTH_TYPE": ["AFERO", "OAUTH2"],
        "MENU_VIEW_TYPE": ["CLASSIC", "SETTINGS"],
        "DEVICE_BROWSER_TYPE": ["HEX", "CARDS"],
        "DAY": ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"],
        "TIME_OF_DAY": ["BREAKFAST", "LUNCH", "SNACK", "DINNER"],
		"SAFE_IMAGES": ["asr_1", "ac_icon_large"]
    }
}
```


Output:
Constants.swift
```Swift
/* Generated with Sango, by Afero.io */

import UIKit
public struct Constants {
	public struct Colors {
		static let Gray01 = UIColor(red: 0.882, green: 0.875, blue: 0.863, alpha: 1.0) /* #E1DFDC */
		static let Gray01_50 = UIColor(red: 0.949, green: 0.929, blue: 0.922, alpha: 1.0) /* #F2EDEB */
		static let Gray02 = UIColor(red: 0.749, green: 0.737, blue: 0.718, alpha: 1.0) /* #BFBCB7 */
		static let Gray02_50 = UIColor(red: 0.816, green: 0.796, blue: 0.78, alpha: 1.0) /* #D0CBC7 */
		static let Gray03 = UIColor(red: 0.616, green: 0.612, blue: 0.596, alpha: 1.0) /* #9D9C98 */
		static let Gray03_50 = UIColor(red: 0.643, green: 0.627, blue: 0.6, alpha: 1.0) /* #A4A099 */
		static let Gray04 = UIColor(red: 0.522, green: 0.529, blue: 0.541, alpha: 1.0) /* #85878A */
		static let Gray04_50 = UIColor(red: 0.494, green: 0.482, blue: 0.467, alpha: 1.0) /* #7E7B77 */
		static let Gray05 = UIColor(red: 0.443, green: 0.451, blue: 0.459, alpha: 1.0) /* #717375 */
		static let Gray06 = UIColor(red: 0.38, green: 0.384, blue: 0.392, alpha: 1.0) /* #616264 */
		static let Gray07 = UIColor(red: 0.325, green: 0.333, blue: 0.341, alpha: 1.0) /* #535557 */
		static let Orange01 = UIColor(red: 0.929, green: 0.675, blue: 0.576, alpha: 1.0) /* #EDAC93 */
		static let Orange01_50 = UIColor(red: 0.965, green: 0.49, blue: 0.294, alpha: 1.0) /* #F67D4B */
		static let Orange02 = UIColor(red: 0.922, green: 0.643, blue: 0.522, alpha: 1.0) /* #EBA485 */
		static let Orange03 = UIColor(red: 0.937, green: 0.58, blue: 0.443, alpha: 1.0) /* #EF9471 */
		static let Orange04 = UIColor(red: 0.949, green: 0.518, blue: 0.357, alpha: 1.0) /* #F2845B */
		static let Orange05 = UIColor(red: 0.957, green: 0.451, blue: 0.267, alpha: 1.0) /* #F47344 */
		static let Orange06 = UIColor(red: 0.965, green: 0.49, blue: 0.294, alpha: 1.0) /* #F67D4B */
		static let White01 = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) /* #FFFFFF */
		static let White01_50 = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) /* #FFFFFF */
	}
	public static let Empty = [
			""
		]
	public static let FloatyNumbers = [
			1,
			2,
			3.15,
			23,
			415.03
		]
	public static let Hello = [
			"one",
			"two",
			"three"
		]
	public static let InteryNumbers = [
			5,
			23,
			54,
			120,
			100
		]
	public static let RainbowColors = [
			UIColor(red: 0.325, green: 0.333, blue: 0.341, alpha: 1.0) /* #535557 */,
			UIColor(red: 0.616, green: 0.612, blue: 0.596, alpha: 1.0) /* #9D9C98 */,
			UIColor(red: 0.949, green: 0.518, blue: 0.357, alpha: 1.0) /* #F2845B */,
			UIColor(red: 0.965, green: 0.49, blue: 0.294, alpha: 1.0) /* #F67D4B */,
			UIColor(red: 0.929, green: 0.675, blue: 0.576, alpha: 1.0) /* #EDAC93 */
		]
	public struct Service {
{'fraction_non_alphanumeric': 0.1920107154112827, 'fraction_numerical': 0.11109360226914591, 'mean_word_length': 3.610606610969851, 'pattern_counts': {'":': 142, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2155613', 'n_tokens_mistral': 6553, 'n_tokens_neox': 5460, 'n_words': 1249}