-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* advanced flow - add `profileSettings` deeplink to move to profileSettings (even when in taskDetail) - replace profile settings menu barbutton with showing an actual `ProfileSettings` vc * cleanup - moved the no step example to `No Step` feature - updated logic for task cell - update to readme - cleanup handle(step:) methods
- Loading branch information
1 parent
d46a7c2
commit de736b4
Showing
15 changed files
with
579 additions
and
60 deletions.
There are no files selected for viewing
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
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
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
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
55 changes: 55 additions & 0 deletions
55
SwordinatorDemo/SwordinatorDemo/Features/No Step/NoStepCoordinator.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,55 @@ | ||
// | ||
// NoStepCoordinator.swift | ||
// SwordinatorDemo | ||
// | ||
// Created by Timotheus Laubengaier on 2021/10/15. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
import Swordinator | ||
|
||
protocol NoStepCoordinatorHandling: AnyObject { | ||
func handle(event: NoStepCoordinator.Event) | ||
} | ||
|
||
|
||
class NoStepCoordinator: NavigationControllerCoordinator, ParentCoordinated | ||
{ | ||
enum Event { | ||
case something | ||
case something2 | ||
} | ||
|
||
var parent: (Coordinator & NoStepCoordinatorHandling)? | ||
var navigationController: UINavigationController | ||
var childCoordinators: [Coordinator] = [] | ||
|
||
let services: AppServices | ||
|
||
init(navigationController: UINavigationController, services: AppServices) { | ||
self.navigationController = navigationController | ||
self.services = services | ||
start() | ||
} | ||
|
||
func start() { | ||
let vc = NoStepViewController() | ||
vc.coordinator = self | ||
navigationController.setViewControllers([ | ||
vc | ||
], animated: false) | ||
} | ||
} | ||
|
||
// MARK: - NoStepViewControllerHandling | ||
extension NoStepCoordinator: NoStepViewControllerHandling { | ||
func handle(event: NoStepViewController.Event) { | ||
switch event { | ||
case .noStepExample1: | ||
parent?.handle(event: .something) | ||
case .noStepExample2: | ||
parent?.handle(event: .something2) | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
SwordinatorDemo/SwordinatorDemo/Features/No Step/NoStepViewController.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,32 @@ | ||
// | ||
// NoStepViewController.swift | ||
// SwordinatorDemo | ||
// | ||
// Created by Timotheus Laubengaier on 2021/10/15. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
import Swordinator | ||
|
||
protocol NoStepViewControllerHandling: AnyObject { | ||
func handle(event: NoStepViewController.Event) | ||
} | ||
|
||
|
||
class NoStepViewController: UIViewController, Coordinated { | ||
|
||
enum Event { | ||
case noStepExample1 | ||
case noStepExample2 | ||
} | ||
|
||
weak var coordinator: Coordinator? | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
title = "No Step" | ||
view.backgroundColor = .systemBackground | ||
} | ||
|
||
} |
65 changes: 65 additions & 0 deletions
65
...dinatorDemo/SwordinatorDemo/Features/Profile Settings/Cells/ProfileSettingsListCell.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,65 @@ | ||
// | ||
// ProfileSettingsListCell.swift | ||
// SwordinatorDemo | ||
// | ||
// Created by Timotheus Laubengaier on 2021/10/15. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
class ProfileSettingsListCell: UITableViewCell { | ||
|
||
static let identifier = "ProfileSettingsListCell" | ||
|
||
lazy var iconView: UIImageView = { | ||
let view = UIImageView() | ||
view.tintColor = .label | ||
view.contentMode = .scaleAspectFit | ||
return view | ||
}() | ||
|
||
lazy var titleLabel: UILabel = { | ||
let view = UILabel() | ||
view.font = .systemFont(ofSize: 14, weight: .medium) | ||
return view | ||
}() | ||
|
||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
|
||
selectionStyle = .none | ||
accessoryType = .disclosureIndicator | ||
|
||
contentView.addSubview(iconView) | ||
iconView.snp.makeConstraints { make in | ||
make.leading.equalTo(contentView).inset(20) | ||
make.top.equalTo(contentView).inset(15) | ||
make.bottom.equalTo(contentView).inset(15).priority(999) | ||
make.size.equalTo(20) | ||
} | ||
|
||
contentView.addSubview(titleLabel) | ||
titleLabel.snp.makeConstraints { make in | ||
make.leading.equalTo(iconView.snp.trailing).offset(10) | ||
make.top.bottom.equalTo(contentView) | ||
make.trailing.equalTo(contentView).inset(20) | ||
} | ||
} | ||
|
||
required init?(coder: NSCoder) { return nil } | ||
|
||
override func prepareForReuse() { | ||
super.prepareForReuse() | ||
iconView.image = nil | ||
titleLabel.text = "" | ||
} | ||
|
||
func setup(iconName: String, title: String, isDestructive: Bool = false, showDisclosureIndicator: Bool = false) { | ||
iconView.image = UIImage(systemName: iconName) | ||
titleLabel.text = title | ||
iconView.tintColor = isDestructive ? .systemRed : .label | ||
titleLabel.textColor = isDestructive ? .systemRed : .label | ||
accessoryType = showDisclosureIndicator ? .none : .disclosureIndicator | ||
} | ||
} |
Oops, something went wrong.