Skip to content

Commit

Permalink
Added possibility to conditionally notify ViewModel about appearing/d…
Browse files Browse the repository at this point in the history
…isappearing
  • Loading branch information
Pavel Leonenko committed Nov 29, 2024
1 parent 5746ee4 commit 839e5f6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Softeq.XToolkit.WhiteLabel.iOS/ViewControllerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ public override void ViewDidLoad()
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
ViewModel.OnAppearing();
NotifyViewModelAboutAppearing();
AttachBindings();
}

public override void ViewWillDisappear(bool animated)
{
base.ViewWillDisappear(animated);
DetachBindings();
ViewModel.OnDisappearing();
NotifyViewModelAboutDisappearing();
}

public override void ViewDidDisappear(bool animated)
Expand All @@ -84,6 +84,16 @@ public override void ViewDidDisappear(bool animated)
CloseDialogIfNeeded();
}

protected virtual void NotifyViewModelAboutAppearing()
{
ViewModel.OnAppearing();
}

protected virtual void NotifyViewModelAboutDisappearing()
{
ViewModel.OnDisappearing();
}

protected virtual void DoAttachBindings()
{
}
Expand Down

0 comments on commit 839e5f6

Please sign in to comment.