This repository has been archived by the owner. It is now read-only.
Gem to generate VIPER modules to use them in your Objective-C/Swift projects.
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
VIPERGenDemo Version 0.2.0 Oct 6, 2014
bin Almost working at all Aug 23, 2014
lib Update VIPERWireFrame.m Oct 8, 2014
slides/viper_slides_codemotion.key Fixed misspelling issue Oct 5, 2014
spec Fixed tests Oct 8, 2014
.gitignore Created initial structure Aug 22, 2014
.rspec Added tests Aug 22, 2014
.travis.yml Added codeclimate Aug 23, 2014
Gemfile Updated gemfile Aug 23, 2014
Gemfile.lock Added Gemfile.lock Oct 8, 2014
LICENSE Initial commit Aug 22, 2014
README.md Remove repository status images Jan 25, 2018
rakefile Version 0.1.3 Aug 23, 2014
vipergen.gemspec Updated gem Sep 6, 2014

README.md

Viper Module Generator

⚠️ This project is no longer maintained.

Gem to generate VIPER modules to use them in your Objective-C/Swift projects The implementation scheme returned by this generator is hardly inspired in the example and post of Objc.io, http://www.objc.io/issue-13/viper.html .

Features

Changelog 0.1.6

  • Added templates command to know which templates are available
  • YAML file in each template with the information about the template (more scalable)

Changelog 0.1

  • Added default template
  • Fully components tested

Expected in version 0.2

  • Example project of Redbooth login with notifications
  • FetchedResultsController template
  • Default template in Swift
  • Login template
  • Integrate with XCode as a plugin (http://nshipster.com/xcode-plugins/)

Viper files structure

.objc
+-- DataManager
|   +-- VIPERDataManager.h
|   +-- VIPERDataManager.m
+-- Interactor
|   +-- VIPERInteractor.h
|   +-- VIPERInteractor.m
+-- Presenter
|   +-- VIPERPresenter.h
|   +-- VIPERPresenter.m
+-- ViewController
|   +-- VIPERViewController.h
|   +-- VIPERViewController.m
+-- WireFrame
|   +-- VIPERWireFrame.h
|   +-- VIPERWireFrame.m
+-- Protocols
|   +-- VIPERProtocols.h
.swift
+-- DataManager
|   +-- VIPERDataManager.swift
+-- Interactor
|   +-- VIPERInteractor.swift
+-- Presenter
|   +-- VIPERPresenter.swift
+-- ViewController
|   +-- VIPERViewController.swift
+-- WireFrame
|   +-- VIPERWireFrame.swift
+-- Protocols
|   +-- VIPERProtocols.swift

How to install vipergen ?

You can install it easily as using the gem. With ruby installed in your OSX execute:

sudo gem install vipergen

If everything were right, you should have now the vipergem command available in your system console

How to generate a VIPER module with a given name?

You have just to execute the following command

vipergen generate MyFirstViperModule --path=~/myproject/shared

And then the files structure will be automatically created. Don't forget to add this folder to your project dragging it into the XCode/Appcode inspector

Developer tips

Update the gem

When the gem is updated it has to be reported to the gem repository. I followed this tutorial http://amaras-tech.co.uk/article/43/Creating_executable_gems that basically says that once you have your gem ready execute:

gem build vipergen.gemspec
gem install vipergen-0.1.gem
gem push vipergen-0.1.gem

Then you'll be asked for your credentials in order to make the update in the repo (http://guides.rubygems.org/publishing/)

Add a new template

Are you interested in VIPER and you would like to contribute with this gem adding new templates? Feel free to do it. It's pretty easy. You've just to:

  • Create a folder inside templates with the name of your template
  • You'll have to create inside the templates in both languages, Swift and Objective-C (get inspired from existing templates)
  • Use the word VIPER where you want the name to be replaced in.
  • Remember to add the file viperspec.yml with the description of your template as below:
author: pepi
author_email: pepibumur@gmail.com
template_description: Default template with the simplest structure using VIPER
updated_at: 2014-08-24
  • Report it as a PR in this repo updating the gem version in Gemspec.

Resources