GithubHelp home page GithubHelp logo

akarataev / typhoon-viper Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 1.49 MB

Generamba template for VIPER with Typhoon configurator 🌪

License: MIT License

Liquid 100.00%
generamba template viper typhoon

typhoon-viper's Introduction

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()
            )
        }
    }
}

typhoon-viper's People

Contributors

akarataev avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.