Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/23andme/viperstarterproject

A starter project for creating an iOS app using VIPER architecture
https://github.com/23andme/viperstarterproject

Last synced: about 1 month ago
JSON representation

A starter project for creating an iOS app using VIPER architecture

Awesome Lists containing this project

README

        

# VIPERStarterProject

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][2] as a primer.

## Viper Module scaffolding
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`.

### Adding a new module
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][4] and go through the instructions described [here][3].

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.

[Watch a video of it in action][5]

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()
])
```

## Third-party libraries used

- **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][0]

- **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][1]

[0]: https://github.com/Swinject/Swinject
[1]: https://github.com/Swinject/SwinjectPropertyLoader
[2]: https://www.objc.io/issues/13-architecture/viper/
[3]: https://github.com/23andMe/MobileTemplates/tree/master/iOS/TTAMTemplate
[4]: https://github.com/23andMe/MobileTemplates
[5]: https://youtu.be/O3S183bYvwQ