Skip to content

Generamba template for VIPER with Typhoon configurator 🌪

License

Notifications You must be signed in to change notification settings

akarataev/typhoon-viper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Typhoon VIPER template

Demonstation

Language License Type

This repository contains a Swift-VIPER template for Generamba. The template supports automatic generation of the Typhoon configurator for the VIPER module.

Generamba

Generamba is a code generator made for working with Xcode. Primarily it is designed to generate VIPER modules but it is quite easy to customize it for generation of any other classes.

Template install

  • Run generamba setup in the project root folder. This command helps to create Rambafile that defines all configuration needed to generate code. You can modify this file directly in future.

  • Add typhoon-viper template to the generated Rambafile. Just paste this line to template section:

 - { name: 'typhoon-viper', git: 'https://github.com/askarataev/typhoon-viper.git' }
  • Run generamba template install. Template will be placed in the /Templates folder of your current project.

  • Run generamba gen typhoon-viper [TEMPLATE_NAME]. It creates a module with specific name from typhoon-viper template.

Typhoon configurator

After the Generamba is finished, the Typhoon configurator will be generated. The configurator will look like:

//
//  DemonstrationDemonstrationModuleConfigurator.swift
//  typhoon-viper-demo
//
//  Created by Каратаев Алексей on 03/04/2018.
//  Copyright © 2018 Apptolab. All rights reserved.
//

import UIKit
import Typhoon

class DemonstrationModuleConfigurator: TyphoonAssembly {

    @objc public dynamic func configureDemonstrationViewController() -> Any {
        return TyphoonDefinition.withClass(DemonstrationViewController.self) {
            definition in
            definition?.injectProperty(
                Selector(("output")),
                with: self.configureDemonstrationPresenter()
            )
        }
    }

    @objc public dynamic func configureDemonstrationPresenter() -> Any {
        return TyphoonDefinition.withClass(DemonstrationPresenter.self) {
            definition in
            definition?.injectProperty(
                #selector(getter: UITouch.view),
                with: self.configureDemonstrationViewController()
            )
            definition?.injectProperty(
                Selector(("interactor")),
                with: self.configureDemonstrationInteractor()
            )
            definition?.injectProperty(
                Selector(("router")),
                with: self.configureDemonstrationRouter()
            )
        }
    }

    @objc public dynamic func configureDemonstrationRouter() -> Any {
        return TyphoonDefinition.withClass(DemonstrationRouter.self)
    }

    @objc public dynamic func configureDemonstrationInteractor() -> Any {
        return TyphoonDefinition.withClass(DemonstrationInteractor.self) {
            definition in
            definition?.injectProperty(
                Selector(("output")),
                with: self.configureDemonstrationPresenter()
            )
        }
    }
}

About

Generamba template for VIPER with Typhoon configurator 🌪

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages