Advanced Swift and iOS Intro
Two really important things learned today: protocols and delegates. Protocols define a blueprint of methods and properties that required for a certain functionality. These are behaviors that are expected but not implemented. Delegates are structs/classes that follow a certain protocol and passes off one of its functions to another instance for that instance to run. Protocols and delegates are really important in the MVC scheme of making an app. Imagine you are using an app that has multiple views or pages. You click on a navbar button to go to a certain area of the app and you have the ability to go back. How do all these things happen? Delegations and by extension protocols. Delegation requires protocols to work, and delegation allows for passing of information in-between as well as going to and from different controllers. I think to a typical reader who hasn't done a lot of OOP, it might be confusing but in terms of app development, it is highly relevant.
No comments:
Post a Comment