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:
Stephen Celis
2024-02-01 15:43:52 -08:00
committed by GitHub
parent 20c14387b8
commit 2c3453cb79
19 changed files with 80 additions and 70 deletions

View File

@@ -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)