Template to generate VIPER classes on Xcode.
Swift 5.0
Localizer is responsible for application's localization as follows:
- Localizer.swift
- Setup application's orientation based on applications'language. (Semantic).
- Setup Swizzling.
- Set application's language.
- Check current language.
- LocalizerJSON.swift
- Get value for key in specific screen.
- Save JSON localization model to local JSON file(localization.json).
- Save JSON file(localization.json) to Userdefaults.
- Download Localizer Template or clone the project.
- Copy the
Localizer.xctemplatefolder. - Go to Application folder, browse to the Xcode application icon. Right-click it and choose 'Show Package Contents'.
- Browse to: Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates/iOS/Application
- Paste the
Localizer.xctemplatefolder.
- Install Storage template. Then Choose
Userdefaults - OR
- You can user by own implementation for Userdefaults by replacing the code inside the following two functions:
private static func saveLanguage(language: String) {}private static func getSavedLanguage() -> String {}
- You can user by own implementation for Userdefaults by replacing the code inside the following two functions:
- Start Xcode and Create a new file (
File > New > Fileor⌘N). - Choose
VIPER. - Type in the name of the module you want to create.
- Choose form the drop down list (
LocalizerorLocalizerJSON). - Not required: To create Xcode groups, remove the references to the newly created files and add them back to the project
If you choosed from the drop down list:
-
Localizer
Localizer.swift
-
LocalizerJSON
LocalizerJSON.swift(Prerequisite addLocalizer)