fix: UI access from backgroung warning
This patch fixes a warning about modifying autolayout engine from
a background thread.
Change-Id: I8343ddfc9814d9d620f824525acce3aad7d5c5aa
Reviewed-by: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
diff --git a/Ring/Ring/Features/Walkthrough/CreateAccount/CreateAccountViewController.swift b/Ring/Ring/Features/Walkthrough/CreateAccount/CreateAccountViewController.swift
index 927e33f..6294fba 100644
--- a/Ring/Ring/Features/Walkthrough/CreateAccount/CreateAccountViewController.swift
+++ b/Ring/Ring/Features/Walkthrough/CreateAccount/CreateAccountViewController.swift
@@ -75,7 +75,9 @@
private func bindViewModelToView() {
// handle username registration visibility
- self.viewModel.registerUsername.asObservable().subscribe(onNext: { [unowned self] (isOn) in
+ self.viewModel.registerUsername.asObservable()
+ .observeOn(MainScheduler.instance)
+ .subscribe(onNext: { [unowned self] (isOn) in
UIView.animate(withDuration: 0.3, animations: {
if isOn {
self.registerUsernameHeightConstraint.constant = self.registerUsernameHeightConstraintConstant
@@ -109,7 +111,9 @@
.bind(to: self.registerUsernameErrorLabel.rx.text).disposed(by: self.disposeBag)
// handle creation state
- self.viewModel.createState.subscribe(onNext: { [weak self] (state) in
+ self.viewModel.createState
+ .observeOn(MainScheduler.instance)
+ .subscribe(onNext: { [weak self] (state) in
switch state {
case .started:
self?.showAccountCreationInProgress()