mardi 26 novembre 2019

Presenting a view controller based on a policy in swift

I have some policy in my application which values are changed. For instance:

var canGoToPageX

when the value of canGoToPageX is true, user can be redirected to "x" view controller

if canGoToPageX {
   present X view controller
}

this View controller is presented in several pages, if a developer forgets to write the if condition, user will be redirected to a page which he doesn't allowed.

I wanna do something to avoid this mistake
Is there any design pattern for this?

Aucun commentaire:

Enregistrer un commentaire