-
Notifications
You must be signed in to change notification settings - Fork 82
/
___FILEBASENAME___Presenter.swift.erb
61 lines (48 loc) · 2.01 KB
/
___FILEBASENAME___Presenter.swift.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright (c) ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
//
// This file was generated by the 🐍 VIPER generator
//
import UIKit
<% if @template.generate_io -%>
import RxSwift
import RxCocoa
<% end -%>
final class ___VARIABLE_moduleName___Presenter {
// MARK: - Private properties -
private unowned let view: ___VARIABLE_moduleName___ViewInterface
<% if @complexity.generate_formatter -%>
private let formatter: ___VARIABLE_moduleName___FormatterInterface
<% end -%>
<% if @complexity.generate_interactor -%>
private let interactor: ___VARIABLE_moduleName___InteractorInterface
<% end -%>
private let wireframe: ___VARIABLE_moduleName___WireframeInterface
// MARK: - Lifecycle -
init(view: ___VARIABLE_moduleName___ViewInterface, <%= @complexity.generate_formatter ? 'formatter: ___VARIABLE_moduleName___FormatterInterface, ' : '' %><%= @complexity.generate_interactor ? 'interactor: ___VARIABLE_moduleName___InteractorInterface, ' : '' %>wireframe: ___VARIABLE_moduleName___WireframeInterface) {
self.view = view
<%- if @complexity.generate_formatter -%>
self.formatter = formatter
<%- end -%>
<%- if @complexity.generate_interactor -%>
self.interactor = interactor
<%- end -%>
self.wireframe = wireframe
}
}
// MARK: - Extensions -
extension ___VARIABLE_moduleName___Presenter: ___VARIABLE_moduleName___PresenterInterface {
<%- if @template.generate_io -%>
func configure(with output: ___VARIABLE_moduleName___.ViewOutput) -> ___VARIABLE_moduleName___.ViewInput {
<%- if @complexity.generate_formatter -%>
let formatterInput = ___VARIABLE_moduleName___.FormatterInput()
let formatterOutput = formatter.format(for: formatterInput)
<%- end -%>
return ___VARIABLE_moduleName___.ViewInput(<%= @complexity.generate_formatter ? 'models: formatterOutput' : '' %>)
}
<%- end -%>
}