1

I have an app (XCode 8 + Swift 3), used by teacher and student. User need to login first. For teacher, after login, we show different content than student login. Login view is the same for both teacher and student.

My questions are:

  1. Should I create two apps, one for teacher one for student or should I only create one app but dynamically show different view for different user group?

  2. If the answer is only make one app, what is the best practice to do concerning show different view for different user type after login? Is there a good tutorial on this?

===== NOTE ====

I know I could use either way, so, the answer I am expecting is which one is better for my needs, not I could do one app, I could do two apps, I know that. If there is no one way better than the other, it is also nice to voice up. Thanks.

Leem.fin
  • 40,781
  • 83
  • 202
  • 354
  • I think you colud do this one app. But you have to do extra text form in your login form. Value of text form is student or teacher. If a student login as student then he/she access you want to show him/her. Like teacher also. For that reason you have to add user role. – A.A Noman Aug 09 '17 at 08:16

1 Answers1

0

You don't need a separate app for a different role: the framework gives you enough tools to do it in a single app. Typically, one app is a better choice, because it lets you share visuals through a storyboard. It also makes it easier to expand your app to other roles in the future (e.g. adding a teacher's supervisor role or a student's parent role).

In your storyboard make two segues from the login screen - one to the teacher's initial view controller, and one to the student's initial view controller. In the code behind your login button check if the current login belongs to a teacher or to a student, and activate the corresponding segue:

if roleIsTeacher {
    performSegue(withIdentifier: "teacherSegue", sender: nil)
} else {
    performSegue(withIdentifier: "studentSegue", sender: nil)
}
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523