Regen generates objective-c\swift code for accessing your images and localized string.
For the first time installation add the custom repo using brew tap
:
brew tap idomizrachi/regen
Install regen:
brew install regen
Verify installation:
regen --version
or
regen
Images and localization code is now generated based on a stencil templated instead of hardcoded
Fix issue in localization generated file of wrong class/struct name
Fix project install configuration.
Images generated class reflects the xcassets folders hierarchy
The images generated class reflects the folders hierarchy of the .xcassets file.
For example:
Images.xcassets -> Icons/logo
will be generated as:
Images.sharedInstance.icons.logo
for objective-c
and will be generated as:
Images.shared.icons.logo
for swift
Improve generated property names
Added new parameter to remove console color
Run localization operation only on the english strings file to save time
Update color codes
Added swift generated files
Print additional information during the execution using "-v" or "--verbose"
Build once to generate the files
Add the generated files to your project, make sure to uncheck the "Copy items if needed" option
Update your code:
- Import the classes
#import "Images.h"
#import "Strings.h"
- Update your code from:
[UIImage imageNamed: @"login-button"]
To:
[UIImage imageNamed: Images.sharedInstance.loginButton]
And from:
NSLocalizedString(@"login.button", @"Login")
To:
Localization.loginButton
https://github.com/icodeforlove/Colors for the ANSI color library
https://github.com/stencilproject/Stencil for the template engine
https://github.com/kylef/PathKit - stencil dependency
https://github.com/kylef/Spectre.git - stencil dependecy