-
Notifications
You must be signed in to change notification settings - Fork 0
SwiftJsonUI 7.2.0 Release Notes
Released: August 31, 2025
SwiftJsonUI 7.2.0 introduces a comprehensive Resource Management System that automates the extraction, management, and generation of colors and strings from your JSON layout files.
ColorManager automatically extracts color values from your JSON layouts and creates a centralized color management system that works seamlessly with both UIKit and SwiftUI.
The build process now automatically scans all JSON layout files and extracts color values from properties like:
backgroundColortextColortintColorborderColorhighlightColor- And all other color-related attributes
When hex colors are found in layouts, ColorManager generates descriptive names based on RGB values:
-
#007AFF→blue_007AFF -
#FF5733→orange_red_FF5733 -
#F2F2F7→pale_gray_F2F2F7
colors.json - Define your app's color palette:
{
"primary_blue": "#007AFF",
"background_gray": "#F2F2F7",
"text_primary": "#000000"
}defined_colors.json - Track undefined colors for future definition:
{
"#FF5733": "orange_red_FF5733",
"#28A745": "green_28A745"
}ColorManager.swift is automatically generated with type-safe accessors:
// UIKit
view.backgroundColor = ColorManager.uikit.primaryBlue
// SwiftUI
Text("Hello")
.foregroundColor(ColorManager.swiftui.primaryBlue)Enable ColorManager by setting resource_manager_directory in sjui.config.json:
{
"resource_manager_directory": "ResourceManager"
}StringManager extracts text strings from JSON layouts and provides automatic localization support for multi-language apps.
Extracts strings from:
-
textproperties in all components -
partial_attributes.range.textfor attributed text - Any text content in layouts
-
Defined strings: Snake_case keys like
welcome_messageare treated as localization keys - Undefined strings: Direct text like "Welcome!" is extracted for localization
-
strings.json- String definitions with translations -
.stringsfiles - Native iOS localization files -
StringManager.swift- Type-safe string accessors
- Strings are automatically extracted during build
- Missing translations are marked with
NOT_IMPLEMENTED_YET - Update
strings.jsonwith translations - Build regenerates
.stringsfiles
The colorProvider in SwiftJsonUIConfiguration now has proper priority handling:
SwiftJsonUIConfiguration.shared.colorProvider = { colorName in
// Your custom color resolution
return MyColorPalette.color(for: colorName)
}Priority order:
- Custom
colorProvider - ColorManager definitions
- System defaults
Project/
├── Layouts/
│ └── Resources/
│ ├── colors.json # Color definitions
│ ├── defined_colors.json # Undefined color tracking
│ ├── strings.json # String definitions
│ └── .strings files # iOS localization
├── ResourceManager/
│ ├── ColorManager.swift # Generated color accessors
│ └── StringManager.swift # Generated string accessors
└── sjui.config.json
Add to sjui.config.json:
{
"resource_manager_directory": "ResourceManager"
}sjui buildThe build process will:
- Extract all colors and strings from JSON layouts
- Update resource JSON files
- Generate Swift accessor classes
- Apply strings to localization files
// UIKit
label.textColor = ColorManager.uikit.textPrimary
// SwiftUI
Text("Hello")
.foregroundColor(ColorManager.swiftui.textPrimary)// UIKit
label.text = StringManager.welcomeMessage
// SwiftUI
Text(StringManager.welcomeMessage)7.2.0 is fully backward compatible. To enable new features:
- Update to SwiftJsonUI 7.2.0
- Add
resource_manager_directoryto config - Run
sjui buildto generate resources - Optionally migrate hardcoded colors/strings to use generated accessors
- Fixed cache file paths for SwiftUI builds
- Improved handling of color properties in dynamic components
- Better error handling for malformed JSON files
- Fixed duplicate property issues in generated code
- ColorManager - Detailed color management guide
- StringManager - String extraction and localization
- SwiftJsonUIConfiguration - Configuration options