-
Notifications
You must be signed in to change notification settings - Fork 0
/
monster_create_rib.sh
executable file
Β·151 lines (106 loc) Β· 3.76 KB
/
monster_create_rib.sh
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/bash
name=$1
base_dir=$2
storage=$3
mkdir -p "${base_dir}/$name"
# Builder
echo "import RIBs
import ${storage}UserInterface
final class ${name}Component: Component<${name}Dependency> {
}
public final class ${name}Builder: Builder<${name}Dependency>, ${name}Buildable {
public override init(dependency: ${name}Dependency) {
super.init(dependency: dependency)
}
public func build(withListener listener: ${name}Listener, cuttentImageIndex: Int?) -> ViewableRouting {
let component = Component(dependency: dependency)
let viewController = ${name}ViewController()
let interactor = ${name}Interactor(presenter: viewController)
interactor.listener = listener
return ${name}Router(interactor: interactor, viewController: viewController)
}
}" > "${base_dir}/${name}/${name}Builder.swift"
# Interactor
echo "import RIBs
import RxSwift
import DesignSystem
import Foundation
import ${storage}UserInterface
protocol ${name}Routing: ViewableRouting {
}
protocol ${name}Presentable: Presentable {
var listener: ${name}Listener? { get set }
}
final class ${name}Interactor: PresentableInteractor<${name}Presentable>, ${name}Listener, ${name}Interactable {
weak var router: ${name}Routing?
weak var listener: ${name}Listener?
override init(presenter: ${name}Presentable) {
super.init(presenter: presenter)
presenter.listener = self
}
deinit {
}
override func didBecomeActive() {
super.didBecomeActive()
}
override func willResignActive() {
super.willResignActive()
}
}
extension ${name}Interactor {
func communityBackground() {
}
}" > "${base_dir}/${name}/${name}Interactor.swift"
# Router
echo "import RIBs
import ${storage}UserInterface
protocol ${name}Interactable: Interactable {
var router: ${name}Routing? { get set}
var listener: ${name}Listener? { get set}
}
protocol ${name}ViewControllable: ViewControllable {
}
final class ${name}Router: ViewableRouter<${name}Interactable, ${name}ViewControllable>, ${name}Routing {
override init(interactor: ${name}Interactable, viewController: ${name}ViewControllable) {
super.init(interactor: interactor, viewController: viewController)
interactor.router = self
}
}" > "${base_dir}/${name}/${name}Router.swift"
# ViewController
echo "import UIKit
import ${storage}UserInterface
class ${name}ViewController: UIViewController, ${name}Presentable, ${name}ViewControllable, ${name}Listener {
var listener: ${name}Listener?
public var uiviewController: UIViewController {
return self
}
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
}
}" > "${base_dir}/${name}/${name}ViewController.swift"
# Buildable
echo "import RIBs
public protocol ${name}Buildable: Buildable {
// Interface λ‘ λ³΄λ΄μ£ΌμΈμ
func build(withListener listener: ${name}Listener , cuttentImageIndex: Int?) -> ViewableRouting
}" > "${base_dir}/${name}/${name}Buildable.swift"
# Dependency
echo "import RIBs
public protocol ${name}Dependency: Dependency {
// Interface λ‘ λ³΄λ΄μ£ΌμΈμ
}" > "${base_dir}/${name}/${name}Dependency.swift"
# Listener
echo "import RIBs
import UIKit
public protocol ${name}Listener: AnyObject {
// Interface λ‘ λ³΄λ΄μ£ΌμΈμ
func communityBackground()
}" > "${base_dir}/${name}/${name}Listener.swift"
echo "-----------------------------------------"
echo "$2 κ²½λ‘μ $1 맀μ₯μ΄ $3 μμ μ μͺ½μ μ
μ νμ΅λλ€! πΎ"
echo "π£οΈ κ²½λ‘: $2"
echo "π¬ 맀μ₯: $1"
echo "π μΆκ°λ μΈν°νμ΄μ€: $3"
echo "-----------------------------------------"
echo "κΌ λ°©λ¬Έν΄μ£ΌμΈμ π"