From the course: iOS Lean Controllers: 2 Controls, Views, Extensions, and Networking
Unlock this course with a free trial
Join today to access over 22,400 courses taught by industry experts.
Implementing LoginHandler
From the course: iOS Lean Controllers: 2 Controls, Views, Extensions, and Networking
Implementing LoginHandler
- [Instructor] In the last lecture you learned that how you can present a login view controller, when a secured tab item, tab bar item, is pressed or selected, but you also saw that we had to duplicate code into multiple view controllers that were meant to be secure. Although that's a solution but that's not really a good solution right? That's not really a maintainable solution. If you had more tab bar items then it's gonna get really hectic and you'll have a lot of duplicate code. So how can we make it a little bit better? Or much better? We want to do concrete setting up of which view controllers are part of handling login, or securing. So let's start by adding a protocol. And let's call it LoginHandler protocol. You can call it anything. I'm just gonna call it LoginHandler. Let me just import UIKit, we might be needing that. So protocol LoginHandler, which is performed on the classes, and it will only have one particular method. Or function, validate. Now of course validate…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.