shuhelohelo’s blog

Xamarin.Forms多めです.

Xamarin.Forms: Shellを使う場合のログインFlow

mallibone.com

Shellは先頭のShellContentがデフォルトで表示されることを利用し,ローディングページ(LoadingPage)をShellContentとして先頭に置いている.

LoadingPageはLoadingPage.xaml.csで以下のように初期化処理を行っている.

        internal LoadingViewModel ViewModel { get; set; } = Locator.Current.GetService<LoadingViewModel>();

        protected override void OnAppearing()
        {
            base.OnAppearing();
            ViewModel.Init();
    }

この初期化処理の中で次の画面への遷移が行われる.

すべてShellの中で行う.なるほどね.

自分がやった方法

スプラッシュ,ログイン,登録画面はShellの中に入れなかった.

ログイン後にShellに遷移する形式.

うーん,どっちがいいかなぁ.

ソースコード

github.com