Skip to content

Commit 13b7858

Browse files
committed
Add Clean Swift templates.
0 parents commit 13b7858

15 files changed

+536
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Others
2+
.DS_Store
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// ___FILENAME___
3+
// ___PROJECTNAME___
4+
//
5+
// Created ___FULLUSERNAME___ on ___DATE___.
6+
// Copyright © ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
// MARK: - Repository operation result.
12+
13+
/// Enum to know repository operation result.
14+
///
15+
/// - ok: operation finished without error.
16+
/// - error: operation finished with error.
17+
enum ___VARIABLE_cleanSwiftModuleName___RepositoryResult: Int {
18+
19+
case ok
20+
case error
21+
22+
init() {
23+
self = .ok
24+
}
25+
}
26+
27+
// MARK: - Protocol functions.
28+
29+
protocol ___VARIABLE_cleanSwiftModuleName___Repository {
30+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// ___FILENAME___
3+
// ___PROJECTNAME___
4+
//
5+
// Created ___FULLUSERNAME___ on ___DATE___.
6+
// Copyright © ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
// MARK: - Implement protocol functions.
12+
13+
class ___VARIABLE_cleanSwiftModuleName___RepositoryImplement: ___VARIABLE_cleanSwiftModuleName___Repository {
14+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//
2+
// ___FILENAME___
3+
// ___PROJECTNAME___
4+
//
5+
// Copyright © ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
6+
//
7+
8+
import Foundation
9+
10+
protocol ___VARIABLE_cleanSwiftModuleName___BusinessLogic {
11+
func doLoadStaticData(request: ___VARIABLE_cleanSwiftModuleName___.StaticData.Request)
12+
}
13+
14+
protocol ___VARIABLE_cleanSwiftModuleName___DataStore {
15+
}
16+
17+
class ___VARIABLE_cleanSwiftModuleName___Interactor: ___VARIABLE_cleanSwiftModuleName___BusinessLogic, ___VARIABLE_cleanSwiftModuleName___DataStore {
18+
19+
// MARK: - Properties
20+
21+
var presenter: ___VARIABLE_cleanSwiftModuleName___PresentationLogic?
22+
23+
// MARK: - Public
24+
25+
func doLoadStaticData(request: ___VARIABLE_cleanSwiftModuleName___.StaticData.Request) {
26+
let response = ___VARIABLE_cleanSwiftModuleName___.StaticData.Response()
27+
presenter?.presentStaticData(response: response)
28+
}
29+
30+
// MARK: - Private
31+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// ___FILENAME___
3+
// ___PROJECTNAME___
4+
//
5+
// Copyright © ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
6+
//
7+
8+
import Foundation
9+
10+
// MARK: - Use cases
11+
12+
enum ___VARIABLE_cleanSwiftModuleName___ {
13+
enum StaticData {
14+
struct Request {
15+
}
16+
17+
struct Response {
18+
}
19+
20+
struct ViewModel {
21+
}
22+
}
23+
}
24+
25+
// MARK: - Business models
26+
27+
// MARK: - View models
28+
29+
struct ___VARIABLE_cleanSwiftModuleName___ViewData {
30+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// ___FILENAME___
3+
// ___PROJECTNAME___
4+
//
5+
// Copyright © ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
6+
//
7+
8+
import Foundation
9+
10+
protocol ___VARIABLE_cleanSwiftModuleName___PresentationLogic {
11+
func presentStaticData(response: ___VARIABLE_cleanSwiftModuleName___.StaticData.Response)
12+
}
13+
14+
class ___VARIABLE_cleanSwiftModuleName___Presenter: ___VARIABLE_cleanSwiftModuleName___PresentationLogic {
15+
16+
// MARK: - Properties
17+
18+
weak var viewController: ___VARIABLE_cleanSwiftModuleName___DisplayLogic?
19+
20+
// MARK: - Public
21+
22+
func presentStaticData(response: ___VARIABLE_cleanSwiftModuleName___.StaticData.Response) {
23+
let viewModel = ___VARIABLE_cleanSwiftModuleName___.StaticData.ViewModel()
24+
viewController?.displayStaticData(viewModel: viewModel)
25+
}
26+
27+
// MARK: - Private
28+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// ___FILENAME___
3+
// ___PROJECTNAME___
4+
//
5+
// Copyright © ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
6+
//
7+
8+
import UIKit
9+
10+
protocol ___VARIABLE_cleanSwiftModuleName___RoutingLogic {
11+
func routeBack()
12+
}
13+
14+
protocol ___VARIABLE_cleanSwiftModuleName___DataPassing {
15+
var dataStore: ___VARIABLE_cleanSwiftModuleName___DataStore? { get }
16+
}
17+
18+
class ___VARIABLE_cleanSwiftModuleName___Router: ___VARIABLE_cleanSwiftModuleName___RoutingLogic, ___VARIABLE_cleanSwiftModuleName___DataPassing {
19+
20+
// MARK: - Properties
21+
22+
weak var viewController: ___VARIABLE_cleanSwiftModuleName___ViewController?
23+
var dataStore: ___VARIABLE_cleanSwiftModuleName___DataStore?
24+
25+
// MARK: - Routing
26+
27+
func routeBack() {
28+
viewController?.navigationController?.popViewController(animated: true)
29+
}
30+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//
2+
// ___FILENAME___
3+
// ___PROJECTNAME___
4+
//
5+
// Copyright © ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
6+
//
7+
8+
import UIKit
9+
10+
class ___VARIABLE_cleanSwiftModuleName___View: UIView {
11+
12+
// MARK: - Constants
13+
14+
private struct ViewTraits {
15+
}
16+
17+
// MARK: - Properties
18+
19+
// MARK: - Lifecycle
20+
21+
override init(frame: CGRect) {
22+
super.init(frame: frame)
23+
setupComponents()
24+
setupConstraints()
25+
}
26+
27+
required init?(coder aDecoder: NSCoder) {
28+
fatalError("init(coder:) has not been implemented")
29+
}
30+
31+
// MARK: - Actions
32+
33+
// MARK: - Public
34+
35+
func setupUI(data: ___VARIABLE_cleanSwiftModuleName___ViewData) {
36+
}
37+
38+
// MARK: - Private
39+
40+
private func setupComponents() {
41+
}
42+
43+
private func setupConstraints() {
44+
NSLayoutConstraint.activate([
45+
])
46+
}
47+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
//
2+
// ___FILENAME___
3+
// ___PROJECTNAME___
4+
//
5+
// Copyright © ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.
6+
//
7+
8+
import UIKit
9+
10+
protocol ___VARIABLE_cleanSwiftModuleName___DisplayLogic: AnyObject {
11+
func displayStaticData(viewModel: ___VARIABLE_cleanSwiftModuleName___.StaticData.ViewModel)
12+
}
13+
14+
class ___VARIABLE_cleanSwiftModuleName___ViewController: UIViewController {
15+
16+
// MARK: - Properties
17+
18+
var interactor: ___VARIABLE_cleanSwiftModuleName___BusinessLogic?
19+
var router: (___VARIABLE_cleanSwiftModuleName___RoutingLogic & ___VARIABLE_cleanSwiftModuleName___DataPassing)?
20+
21+
private let sceneView = ___VARIABLE_cleanSwiftModuleName___View()
22+
23+
// MARK: - Object's lifecycle
24+
25+
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
26+
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
27+
setup()
28+
}
29+
30+
required init?(coder aDecoder: NSCoder) {
31+
super.init(coder: aDecoder)
32+
setup()
33+
}
34+
35+
// MARK: - Setup
36+
37+
private func setup() {
38+
let viewController = self
39+
let interactor = ___VARIABLE_cleanSwiftModuleName___Interactor()
40+
let presenter = ___VARIABLE_cleanSwiftModuleName___Presenter()
41+
let router = ___VARIABLE_cleanSwiftModuleName___Router()
42+
viewController.interactor = interactor
43+
viewController.router = router
44+
interactor.presenter = presenter
45+
presenter.viewController = viewController
46+
router.viewController = viewController
47+
router.dataStore = interactor
48+
}
49+
50+
// MARK: - View's lifecycle
51+
52+
override func loadView() {
53+
view = sceneView
54+
}
55+
56+
override func viewDidLoad() {
57+
super.viewDidLoad()
58+
setupNavigationBar()
59+
doLoadStaticData()
60+
}
61+
62+
// MARK: - Private
63+
64+
private func setupNavigationBar() {
65+
}
66+
}
67+
68+
// MARK: - Output
69+
70+
extension ___VARIABLE_cleanSwiftModuleName___ViewController {
71+
72+
private func doLoadStaticData() {
73+
let request = ___VARIABLE_cleanSwiftModuleName___.StaticData.Request()
74+
interactor?.doLoadStaticData(request: request)
75+
}
76+
}
77+
78+
// MARK: - Input
79+
80+
extension ___VARIABLE_cleanSwiftModuleName___ViewController: ___VARIABLE_cleanSwiftModuleName___DisplayLogic {
81+
82+
func displayStaticData(viewModel: ___VARIABLE_cleanSwiftModuleName___.StaticData.ViewModel) {
83+
}
84+
}
76.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)