# SWIFT VIPER GENERATOR aka SWIVIGEN

## Installation

Requirements:
* python3
* pip3
* XCode that supports recent versions of Swift

To install run 
`pip3 install SwiftViperGenerator`

## Usage

`swivigen [-h] [--init] [-c CONFIG] project module` where
* `project` is XCode project that should be modified (specify with .xcodeproj extension)
* `module` is name for new VIPER module, for example, Login or Options
*  ` -h` or ` --help` will show help (actually this paragraph)
* `--init` will add base swivigen Swift files into project
* `-c` or `--config` is path to YAML config file; if not specified, swivigen will try to use viper.yml file in current folder

YAML config file has next structure:

	project_dir: PROJECT_DIR
	templates_dir: TEMPLATES_DIR
	uikit_controllers_group: XCODEPROJ_GROUP
	author: AUTHOR

where
* PROJECT_DIR is a directory of project that should be used (useful in case it has different name with project itself); should be relative to project file e.g. `ProjectFolder` but not `./ProjectFolder`
* TEMPLATES_DIR is a directory with Swift templates; type `$TEMPLATES` to use swivigen default templates
* XCODEPROJ_GROUP is project group under which generated ViewControllers should be stored
* AUTHOR is a name of project developer or maintainer to use in docucomments

### Note

Sometimes XCode project should be re-opened for changes to take place.

## Structure

swivigen has common files that should be present in project that should use generated sources. You can add common files into project by specifying `--init` option while calling swivigen.

After you run tool with desired module name, you will have router, interactor, presenter and view classes named after that module inside your project (entities currently are not covered). Feel free to rearrange them inside project if you need.\
Also you will have ViewController that is inherited from ViperController that is basically subclass of UIViewController with minor enhancements. You can connect this ViewController with XIB or Storyboard.

Basic example of usage of these classes will come soon.

## License 

MIT License

## Contact

bogdanivanov at live.com
