Starter application demonstrating VIPER architecture. This project will include the required dependencies to start building a VIPER app, using the TTAMTemplate
cli scaffolding tool.
Not familiar with VIPER? Read this article as a primer.
This starter app is best when used with the TTAMTemplate
executable, which will streamline the creation of new modules to be added to the application skeleton. There is a dedicated directory for where the VIPER modules go, named Modules
.
This requires that you have TTAMTemplate
executable installed and copied to your bin. You'll want to checkout out the feature branch feature/viper_templates
for MobileTemplates
project repo and go through the instructions described here.
Once you've successfully installed the cli tool, you're ready to add a new module to the project. Begin by adding a new group for module in Xcode. You'll want to have the option to create folder on disk enabled for this sep. Then navigate to newly created directory in terminal. Once you're inside the directory, run TTAMTemplate
. This will initialize the cli tool in interactive mode. Most of the time, you'll type module
as menu choice when prompted in terminal.
Next step, is to add the files generated by TTAMTemplate
command to Xcode. Do this by navigating to newly created folder group, and press Ctrl+N
and select the Add Files to Project
option in dialog when prompted. You should now see your files appear in your project structure. Then create the module-specific
.strings
file. Be sure to give it the module name as the file name when prompted, as it will already be referenced by the generated localizations file from previous step.
The final step is to make your module available to the container for resolution at runtime. You do this by adding it to the master assembly that gets bootstrapped in AppDelegate
.
For example, if you created a module named FooBar
, then you would add FooBarAssembly
to this list inside AppDelegate
.
let assembler = try Assembler(assemblies: [
WireframeAssembly(),
RootAssembly(),
// add your new modules here
FooBarAssembly()
])
-
Swinject: Dependency injection framework. All application components are registered to and resolved by a container that gets accessed in a series of assemblies that are bootstrapped at application start. Read more
-
SwinjectPropertyLoader: Extension built on top of Swinject, allowing the use of json files for configuration files that can resolved inside assemblies at the time of container resolution. Read more