From bdf8cb201651c915b1df2de7ac27543c10c28f75 Mon Sep 17 00:00:00 2001 From: David Whetstone Date: Tue, 22 Mar 2022 17:53:00 -0700 Subject: [PATCH] fix: crash in MVVM Example Example app crashes after pressing login. In `DefaultLoginViewModel.login()`, `router` is nil. I tracked this down to `RouterStore.retrieve()` failing to cast the stored object. This is due to the line fixed in this commit - `DefaultLoginViewModel.router` had the wrong type declared. --- .../MVVM/Shared/Login/ViewModels/DefaultLoginViewModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/MVVM/Shared/Login/ViewModels/DefaultLoginViewModel.swift b/Examples/MVVM/Shared/Login/ViewModels/DefaultLoginViewModel.swift index f7c001f..836d373 100644 --- a/Examples/MVVM/Shared/Login/ViewModels/DefaultLoginViewModel.swift +++ b/Examples/MVVM/Shared/Login/ViewModels/DefaultLoginViewModel.swift @@ -14,7 +14,7 @@ final class DefaultLoginViewModel: LoginViewModel { // You have two ways of performing routing here. The first one is to use the RouterStore, which is what we're using in this example. The second one is by injecting the coordinator, either in init or by using a dependency injection framework. Using a dependency injection framework is recommended over using RouterObject, since you get a lot more flexibility and features that way. - @RouterObject var router: NavigationRouter! + @RouterObject var router: NavigationRouter! fileprivate let api: API