mirror of
https://github.com/pointfreeco/swift-composable-architecture.git
synced 2025-12-24 12:14:25 +01:00
Some cleanup (#2759)
* Some cleanup - `if/guard let x = x` -> `if/guard let x` - Remove unneeded `self` from a few demos - Fix up some presentation logic in TicTacToe * Update Examples/TicTacToe/tic-tac-toe/Sources/LoginUIKit/LoginViewController.swift * wip * wip * wip
This commit is contained in:
@@ -12,25 +12,23 @@
|
||||
/// ```swift
|
||||
/// class ParentViewController: UIViewController {
|
||||
/// let store: Store<ParentState, ParentAction>
|
||||
/// let viewStore: ViewStore<ViewState, ViewAction>
|
||||
/// private var cancellables: Set<AnyCancellable> = []
|
||||
/// private weak var alertController: UIAlertController?
|
||||
/// // ...
|
||||
/// func viewDidLoad() {
|
||||
/// // ...
|
||||
/// viewStore.publisher
|
||||
/// var alertController: UIAlertController?
|
||||
/// store.publisher
|
||||
/// .settingsAlert
|
||||
/// .sink { [weak self] alert in
|
||||
/// guard let self = self else { return }
|
||||
/// if let alert = alert {
|
||||
/// let alertController = UIAlertController(state: alert, send: {
|
||||
/// self.viewStore.send(.settings($0))
|
||||
/// })
|
||||
/// self.present(alertController, animated: true, completion: nil)
|
||||
/// self.alertController = alertController
|
||||
/// guard let self else { return }
|
||||
/// if let alert {
|
||||
/// alertController = UIAlertController(state: alert) {
|
||||
/// store.send(.settings($0))
|
||||
/// }
|
||||
/// present(alertController!, animated: true, completion: nil)
|
||||
/// } else {
|
||||
/// self.alertController?.dismiss(animated: true, completion: nil)
|
||||
/// self.alertController = nil
|
||||
/// alertController?.dismiss(animated: true, completion: nil)
|
||||
/// alertController = nil
|
||||
/// }
|
||||
/// }
|
||||
/// .store(in: &cancellables)
|
||||
|
||||
Reference in New Issue
Block a user