项目作者: akarataev

项目描述 :
Generamba template for VIPER with Typhoon configurator 🌪
高级语言: Liquid
项目地址: git://github.com/akarataev/typhoon-viper.git
创建时间: 2018-03-31T23:15:37Z
项目社区:https://github.com/akarataev/typhoon-viper

开源协议:MIT License

下载


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:

    1. - { 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:

  1. //
  2. // DemonstrationDemonstrationModuleConfigurator.swift
  3. // typhoon-viper-demo
  4. //
  5. // Created by Каратаев Алексей on 03/04/2018.
  6. // Copyright © 2018 Apptolab. All rights reserved.
  7. //
  8. import UIKit
  9. import Typhoon
  10. class DemonstrationModuleConfigurator: TyphoonAssembly {
  11. @objc public dynamic func configureDemonstrationViewController() -> Any {
  12. return TyphoonDefinition.withClass(DemonstrationViewController.self) {
  13. definition in
  14. definition?.injectProperty(
  15. Selector(("output")),
  16. with: self.configureDemonstrationPresenter()
  17. )
  18. }
  19. }
  20. @objc public dynamic func configureDemonstrationPresenter() -> Any {
  21. return TyphoonDefinition.withClass(DemonstrationPresenter.self) {
  22. definition in
  23. definition?.injectProperty(
  24. #selector(getter: UITouch.view),
  25. with: self.configureDemonstrationViewController()
  26. )
  27. definition?.injectProperty(
  28. Selector(("interactor")),
  29. with: self.configureDemonstrationInteractor()
  30. )
  31. definition?.injectProperty(
  32. Selector(("router")),
  33. with: self.configureDemonstrationRouter()
  34. )
  35. }
  36. }
  37. @objc public dynamic func configureDemonstrationRouter() -> Any {
  38. return TyphoonDefinition.withClass(DemonstrationRouter.self)
  39. }
  40. @objc public dynamic func configureDemonstrationInteractor() -> Any {
  41. return TyphoonDefinition.withClass(DemonstrationInteractor.self) {
  42. definition in
  43. definition?.injectProperty(
  44. Selector(("output")),
  45. with: self.configureDemonstrationPresenter()
  46. )
  47. }
  48. }
  49. }