-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Symlink files - Drastically improved maintainability
- Added code based UI templates and Endpoint template
- Loading branch information
andrej.jasso@goodrequest.com
committed
Sep 13, 2021
1 parent
eaeacdd
commit 57137f3
Showing
107 changed files
with
484 additions
and
2,021 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...tes/Reactor Controller.xctemplate/CollectionViewController/___VARIABLE_ID___Factory.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../Components/factory.swift |
1 change: 1 addition & 0 deletions
1
...ctor Controller.xctemplate/CollectionViewController/___VARIABLE_ID___LayoutComposer.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../Components/layoutComposer.swift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...s/Reactor Controller.xctemplate/CollectionViewController/___VARIABLE_ID___ViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../Components/reactorViewModel.swift |
1 change: 1 addition & 0 deletions
1
...tor Controller.xctemplate/CollectionViewControllerDiffable/___VARIABLE_ID___Factory.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../Components/factory.swift |
1 change: 1 addition & 0 deletions
1
...troller.xctemplate/CollectionViewControllerDiffable/___VARIABLE_ID___LayoutComposer.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../Components/layoutComposer.swift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...r Controller.xctemplate/CollectionViewControllerDiffable/___VARIABLE_ID___ViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../Components/reactorViewModel.swift |
1 change: 1 addition & 0 deletions
1
...emplates/Reactor Controller.xctemplate/TableViewController/___VARIABLE_ID___Factory.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../Components/factory.swift |
159 changes: 159 additions & 0 deletions
159
...s/Reactor Controller.xctemplate/TableViewController/___VARIABLE_ID___ViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
// ___FILEHEADER___ | ||
|
||
import UIKit | ||
import Combine | ||
import GRProvider | ||
|
||
// MARK: - Class | ||
|
||
final class ___VARIABLE_ID___ViewController: BaseViewController<___VARIABLE_ID___ViewModel> { | ||
|
||
// MARK: - TypeAliases | ||
|
||
typealias Section = ___VARIABLE_ID___Factory.Section | ||
|
||
// MARK: - Constaints | ||
|
||
// MARK: - Constants | ||
|
||
private let provider = GRTableViewProvider<Section>() | ||
|
||
private let tableView = UITableView().then { | ||
$0.translatesAutoresizingMaskIntoConstraints = false | ||
} | ||
|
||
private enum C { | ||
|
||
} | ||
|
||
} | ||
|
||
// MARK: - Lifecycle | ||
|
||
extension ___VARIABLE_ID___ViewController { | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
setupTableView() | ||
setupTableProvider() | ||
setupNavigation() | ||
|
||
bindState(reactor: viewModel) | ||
bindActions(reactor: viewModel) | ||
} | ||
|
||
} | ||
|
||
// MARK: - Setup | ||
|
||
private extension ___VARIABLE_ID___ViewController { | ||
|
||
// MARK: - Setup Navigation | ||
|
||
func setupNavigation() { | ||
|
||
} | ||
|
||
// MARK: - Setup Table View | ||
|
||
func setupTableView() { | ||
registerCells() | ||
setupRefreshControl() | ||
} | ||
|
||
func registerCells() { | ||
|
||
} | ||
|
||
func setupRefreshControl() { | ||
// Setup refresh controll action bound to view model action | ||
// | ||
// provider.configureRefreshGesture = { [weak self] _ in | ||
// self?.viewModel.send(event: .refreshData) | ||
// } | ||
} | ||
|
||
// MARK: - Setup Table View Provider | ||
|
||
func setupTableProvider() { | ||
setupCell() | ||
} | ||
|
||
func setupCell() { | ||
|
||
} | ||
|
||
} | ||
|
||
// MARK: - Combine | ||
|
||
extension ___VARIABLE_ID___ViewController { | ||
|
||
func bindState(reactor: ___VARIABLE_ID___ViewModel) { | ||
reactor.state | ||
.map { $0.dataFetchingState } | ||
.removeDuplicates() | ||
.sink { [weak self] state in | ||
// Switch over data fetching states to handle | ||
// | ||
// switch state { | ||
// case .idle: | ||
// self?.showIdleState() | ||
// | ||
// case .loading: | ||
// self?.showLoadingState() | ||
// | ||
// case .failure(let error): | ||
// self?.showErrorState(error: error) | ||
// | ||
// case .empty: | ||
// self?.showEmptyState() | ||
// } | ||
} | ||
.store(in: &cancellables) | ||
|
||
reactor.state | ||
.map { $0.sections } | ||
.removeDuplicates() | ||
.sink { [weak self] sections in | ||
guard let self = self else { return } | ||
self.provider.bind(to: self.tableView, sections: sections) | ||
} | ||
.store(in: &cancellables) | ||
} | ||
|
||
func bindActions(reactor: ___VARIABLE_ID___ViewModel) { | ||
|
||
} | ||
|
||
} | ||
|
||
// MARK: - Private | ||
|
||
extension ___VARIABLE_ID___ViewController { | ||
|
||
// Sample state handling functions | ||
// | ||
// func showIdleState() { | ||
// tableView.refreshControl?.endCurrentRefreshing() | ||
// } | ||
// | ||
// func showLoadingState() { | ||
// | ||
// } | ||
// | ||
// func showErrorState(error: AppError) { | ||
// tableView.refreshControl?.endCurrentRefreshing() | ||
// if viewModel.currentState.sections.isEmpty { | ||
// | ||
// } else { | ||
// | ||
// } | ||
// } | ||
// | ||
// func showEmptyState() { | ||
// tableView.refreshControl?.endCurrentRefreshing() | ||
// } | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
...plates/Reactor Controller.xctemplate/TableViewController/___VARIABLE_ID___ViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../Components/reactorViewModel.swift |
1 change: 1 addition & 0 deletions
1
.../Reactor Controller.xctemplate/TableViewControllerDiffable/___VARIABLE_ID___Factory.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../Components/factory.swift |
Oops, something went wrong.