Skip to content

ladeiko/SwiftyViperTemplates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftyViperTemplates

Collection of Generamba VIPER templates.

Usage

  • create Rambafile at the root of your project folder.
  • add templates description to it (see below)
  • setup all variables
  • in 'Templates' section define all templates or only some them.
  • open terminal in project folder
  • install Generamba
  • run:
generamba template install
  • generamba will fetch required templates to "./Templates" folder
  • now you can generate any new module using generamba: generamba gen MyModuleName SwiftyViperMcFlurryAlert
  • also you can pass additional keys to generamba (see keys supported by these templates): generamba gen MyModuleName SwiftyViperMcFlurryAlert --custom_parameters extended_configure:true
  • most of the templates requires additional pods installed, see concrete template description

Short names of templates

  • tabbar = SwiftyViperMcFlurryTabbar
  • service = SwiftyViperService
  • default = SwiftyViperMcFlurryStoryboard
  • alert = SwiftyViperMcFlurryAlert
  • container = SwiftyViperMcFlurryEmbedStoryboard
  • collection_as_root_and_cachetracker = SwiftyViperMcFlurryStoryboardRootCollectionViewCacheTracker
  • collection_as_root_with_embeddables_and_cachetracker = SwiftyViperMcFlurryStoryboardComplexRootCollectionViewCacheTracker
  • collection_as_secondary_and_cachetracker = SwiftyViperMcFlurryStoryboardCollectionViewCacheTracker
  • collection_as_secondary_with_embeddables_and_cachetracker = SwiftyViperMcFlurryStoryboardComplexCollectionViewCacheTracker
  • table_as_root_and_cachetracker = SwiftyViperMcFlurryStoryboardRootTableViewCacheTracker
  • table_as_root_with_embeddables_and_cachetracker = SwiftyViperMcFlurryStoryboardComplexRootTableViewCacheTracker
  • table_as_secondary_and_cachetracker = SwiftyViperMcFlurryStoryboardTableViewCacheTracker
  • table_as_secondary_with_embeddables_and_cachetracker = SwiftyViperMcFlurryStoryboardComplexTableViewCacheTracker
  • transparent = SwiftyViperMcFlurryTrasparent

Special templates

Most of the templates generate UI modules, but some of them generate lowe level logic modules: services. In project structure services code is located usually in different place than UI. So whil generation you should pass another path for new module location. This can be achieved by passed special keys to generamba:

  • --module_path
  • --test_path
generamba gen My service --module_path MyApp/Services

or if you use tests

generamba gen My service --module_path MyApp/Services --test_path MyAppTests/Services

More generamba info you can find at generamba commands

Custom keys

Keys passed with --custom_parameters to generamba.

generamba gen MyModuleName SwiftyViperMcFlurryAlert --custom_parameters key1:value1 key2:value2 ...

extended_configure:true

Usefull when configuration of module is not trivial. If passed as true:

generamba gen MyModuleName SwiftyViperMcFlurryAlert --custom_parameters extended_configure:true

then configure() method of module input will be generated as:

struct MyModuleConfig {
    // TODO: Place your code here
}

protocol MyModuleInput: AnyObject {

    func configure(with config: MyModuleConfig)

}

In this case you can add more parameters while development to MyModuleConfig without modifying existing code.

embeddable_extended_configure_vars

NOTE: Parameter make sense for templates where embeddable module used only (SwiftyViperMcFlurryStoryboardComplexRootTableViewCacheTracker, etc...).

If defined, then configuration method of embeddable module will generated with input object.

redux_service_state_vars=VARS

NOTE: Parameter make sense for SwiftyViperReduxService only.

redux_service_state_vars:a=AClass,b=BClass?

will produce state variables for service as:

var a: AClass
var b: BClass?

redux_service_state_persistent:true

NOTE: Parameter make sense for SwiftyViperReduxService only.

Generates code for storing state of service to user defaults

redux_service_observable:true

NOTE: Parameter make sense for SwiftyViperReduxService only.

Generates method usifull for observing changes of service in Rx way.

redux_service_generate_state_vars_getters:true

NOTE: Parameter make sense for SwiftyViperReduxService only.

Will generate getters for state vars.

var a: AClass { get }
var b: BClass? { get }

redux_service_generate_state_vars_setters:true

NOTE: Parameter make sense for SwiftyViperReduxService only.

Will generate setters for state vars. Usefull only if redux_service_generate_state_vars_getters:trueis defined.

var a: AClass { get set }
var b: BClass? { get set }

Rambafile example

### Templates
templates:
- {name: default, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: container, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: tabbar, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: alert, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: transparent, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: table_as_root_and_cachetracker, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: table_as_root_with_embeddables_and_cachetracker, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: table_as_secondary_and_cachetracker, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: table_as_secondary_with_embeddables_and_cachetracker, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: collection_as_root_and_cachetracker, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: collection_as_root_with_embeddables_and_cachetracker, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: collection_as_secondary_and_cachetracker, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: collection_as_secondary_with_embeddables_and_cachetracker, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: service, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}
- {name: redux_service, git: 'https://github.com/ladeiko/SwiftyViperTemplates.git'}

Changes

CHANGELOG

Templates

SwiftyViperService

Template for generating viper service using ViperServices module

Required modules


SwiftyViper

Simple viper module where UIViewController is not associated with any XIB/Storyboard file.

Required modules


SwiftyViperXib

Simple viper module where UIViewController is associated with XIB file (which one is also generated).

Required modules


SwiftyViperStoryboard

Simple viper module where UIViewController is associated with Storyboard file (which one is also generated).

Required modules


SwiftyViperMcFlurry

Similar to SwiftyViper, but also generates code which helps to use ViperMcFlurryX module in router.

Required modules


SwiftyViperMcFlurryAlert

Creates module implementing UIAlertController in alert mode using VIPER paradigm.

Required modules


SwiftyViperMcFlurryTrasparent

Creates module with main transparent view presented immediatly event if animation was specified. You can use it to present some other native Apple controller over transparent view. Similar trick is used in SwiftyViperMcFlurryAlert template.

Required modules


SwiftyViperMcFlurryXib

Similar to SwiftyViperXib, but also generates code which helps to use ViperMcFlurryX module in router.

Required modules


SwiftyViperMcFlurryStoryboard

Similar to SwiftyViperStoryboard, but also generates code which helps to use ViperMcFlurryX module in router.

Required modules


SwiftyViperMcFlurryEmbedStoryboard

Similar to SwiftyViperMcFlurryStoryboard, but also generates code to embed another module to current view via storyboard. This can be usefull when you compose module onto some container module. Later you can manually add more containers and embed more modules.

Required modules


SwiftyViperMcFlurryStoryboardCollectionViewCacheTracker

Creates module with UICollectionView as secondary view placed onto main controller view. Also it creates start code to show items stored in database using CacheTracker and CacheTrackerConsumer in plain (no sections) mode.

Required modules


SwiftyViperMcFlurryStoryboardRootCollectionViewCacheTracker

Creates module with UICollectionView as main view of controller (UICollectionViewController). Also it creates start code to show items stored in database using CacheTracker and CacheTrackerConsumer in plain (no sections) mode.

Required modules


SwiftyViperMcFlurryStoryboardRootTableViewCacheTracker

Creates module with UITableView as secondary view placed onto main controller view. Also it creates start code to show items stored in database using CacheTracker and CacheTrackerConsumer in plain (no sections) mode.

Required modules


SwiftyViperMcFlurryStoryboardTableViewCacheTracker

Creates module with UITableView as main view of controller (UITableViewController). Also it creates start code to show items stored in database using CacheTracker and CacheTrackerConsumer in plain (no sections) mode.

Required modules

LICENSE

This project is licensed under the MIT License - see the LICENSE file for details