User recommendations for iOS users

I am creating an application in which some users will have more access to functions than others. The concept is that some users are parents, while others are children, and parents can, for example, add responsibilities, and children can not. I am wondering what are the best practices for implementing such a setup, including:

1. Do I have to have separate storyboards and VC for parents and children? Basically, there are some buttons and functions that should exist on certain pages for parents, as well as additional screens.

2. Is it better to do this to have a role attribute in a custom class?

3. In general, for an application in which information is shared among users (for example, one family), what are the best design methods?

If anyone has any sample Swift code for this kind of thing, it would be very helpful to look since I am just starting out with iOS.

Thanks in advance.

+4
source share
2 answers

In general

1) No. If there are only slight visual differences between the two pages, you should simply hide / change the elements that the user should not see. If the user needs a special presentation, just create this view in your storyboard and show it only if necessary.

2) , , , / .

3) .

. , , : , , " ".

+3

TL;DR

:

  • user-role enum
  • user-role User
  • CurrentUser

enum UserRole {
    case Admin
    case FremiumUser
    case PayingUser
    }
}

struct User {
     var name = "J. Doe"
     var roles = [UserRole]()
}

CurrentUser {
    // Singleton pattern
    static let sharedUser = CurrentUser()
    private init() {}
    var user = User()
}

, . Decorator / - , , , User, CurrentUser. ( , , ) .

?

0

All Articles