Skip to content

Start a iOS project with some base files and structures!

License

Notifications You must be signed in to change notification settings

diegomazzone/swift-mvcgen

 
 

Repository files navigation

MVC Module Generator

⚠️ This project is currently on development and it must be used before project starts, otherwise it will override some of your files.

Gem to generate MVC starting modules to use them in your Swift projects The implementation scheme returned by this generator is hardly inspired in the example and post of vipergen, https://rubygems.org/gems/vipergen/versions/0.2.6 .

Features

MVC files structure

.swift
+-- Helper
|   +-- Utils.swift
|   +-- AWSManager.swift
|   +-- FilesManager.swift
|   +-- APIManager.swift
|   +-- APIRequestBody.swift
|   +-- S3Manager.swift
|   +-- APIHelper.swift
+-- Controllers
|   +-- Login
|   |   +-- LoginVC.swift
|   |   +-- RegisterVC.swift
|   |   +-- ForgetPasswordVC.swift
|   +-- Notifications
|   |   +-- NotificationsVC.swift
|   |   +-- Cells
|   |   |   +-- NotificationsCell.swift
|   +-- Profile
|   |   +-- ProfileContainerVC.swift
|   |   +-- AboutUsVC.swift
|   |   +-- ProfileTVC.swift
|   |   +-- Cells
|   |   |   +-- ImagesCollectionViewCell.swift
|   |   |   +-- DescriptionCell.swift
|   |   |   +-- DestinationCellView.xib
|   |   |   +-- DestinationCell.swift
|   |   |   +-- FavoriteCollectionCell.swift
|   |   |   +-- AboutUsImageCell.swift
|   +-- OtherLogin
|   |   +-- SelectLanguageCell.swift
|   |   +-- OtherRegisterVC.swift
|   |   +-- ForgetPasswordTVC.swift
|   |   +-- LoginTVC.swift
|   |   +-- SelectLanguageVC.swift
|   |   +-- TermsAndConditionsVC.swift
|   +-- Tutorial
|   |   +-- TutorialVC.swift
+-- Extensions
|   +-- Buttons.swift
|   +-- CustomCamera.swift
|   +-- UnderlinedWithIconTextField.swift
|   +-- UnderlinedTextView.swift
|   +-- Utils+Array.swift
|   +-- Utils+Images.swift
|   +-- Utils+String.swift
|   +-- Utils+UIButton.swift
|   +-- Utils+UIColor.swift
|   +-- Utils+UITableView.swift
|   +-- Utils+UITextField.swift
|   +-- Utils+UIView.swift
|   +-- Utils+UIViewController.swift
+-- Models
|   +-- Notif.swift
|   +-- Country.swift
|   +-- User.swift
|   +-- Responeses
|   |   +-- UserResponse.swift
|   |   +-- NotificationResponse.swift
|   |   +-- BaseResponse.swift
|   |   +-- UserSingupResponse.swift
|   +-- Managers
|   |   +-- UserManager.swift
+-- Config
|   +-- Config.plist
|   +-- Config.swift
+-- UI
|   +-- Views
|   |   +-- EmptyTableView
|   |   |   +-- EmptyTableLabelView.swift
|   |   |   +-- NoNotificationView.swift
|   |   |   +-- Xibs
|   |   |   |   +-- EmptyTableLabelView.xib
|   |   |   |   +-- NoNotificationsView.xib
|   +-- Storyboards
|   |   +-- Login.storyboard
|   |   +-- OtherLogin.storyboard
|   |   +-- Home.storyboard
+-- Info.plist
+-- Assets.xcassets
+-- AppDelegate.swift
.podfile
+-- Podfile
|   +-- podfile

How to install mvcgen ?

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

sudo gem install mvcgen

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

How to generate a MVC module with a given name?

You have just to execute the following command standing on your project root folder

mvcgen generate YourProjectName --path=./

And then the files structure will be automatically created and added to the project. Don't forget to run pod install after that

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 mvcgen.gemspec
gem install mvcgen-0.1.gem
gem push mvcgen-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/)

To remove previous gem versions:

gem cleanup mvcgen

Add a new template

Are you interested in this project and you would like to contribute by 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 a swift folder with your files (get inspired from existing templates)
  • Use the word MVCGEN where you want the name to be replaced in.
  • Remember to add the file mvcspec.yml with the description of your template as below:
author: pepito
author_email: [email protected]
template_description: Default template with..
updated_at: 2018-08-01
  • Report it as a PR in this repo updating the gem version in Gemspec.

Resources

About

Start a iOS project with some base files and structures!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 90.3%
  • Ruby 9.7%