In the last demo you learned about static properties and how you can share different properties across your app by making the property directly accessible by everyone.
Here are the things you learned in this lesson:
You introduced the ability to mark a contact as a company contact. That made the usage of your type a little inconvenient so you updated your code by creating two new types, one for person and one for company and you made both of them inherited from the main type ContactCard. That made your code cleaner and you were able to implement the relationship validations in an organized way
You used method overloading to create setters for the different properties with multiple functions that have the same name but different property numbers or same number but different type.
And at the end you used static keyword to be able to create an instance of the ContactsBook to be a single source of truth for all the different parts of your app.
In the next lesson, you’ll continue building on the ContactsBook and solve another issue where anyone can still create their own instances of the book and ignore the instance that you meant to share.
See forum comments
This content was released on Oct 17 2023. The official support period is 6-months
from this date.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.