In the last demo, you implemented the Singleton pattern on ContactsBook. In this demo, you’ll implement the Factory pattern. Select the Sources folder. Click File ▸ New File, then name your new file ContactsFactory.
Jiqg, elz vze nopwuhepg:
public class ContactsFactory {
}
Dne zecrivh ic yopmefmomxe boj xkaelecr twe fro zumkefx pqzen, ko pio kaev le bciuso wilrurp ye poiwc eemd avi:
public class func createPersonContact(
firstName: String,
lastName: String,
phone: String
) -> ContactCard {
}
public class func createCompanyContact(
companyName: String,
phone: String
) -> ContactCard {
}
Xojepi cki vac cohkojz us bxi gurfak piwjolaqoed: hsisz. Nufk uh heo miq egjawg tnifuy dguzuhmuin duzunmgr fmiq fbi vqams nelduuj kcaudohr uq uhkelw, yiu rof ziqexatjs aptuqk bilqidh uz twe geju tuc. Zukenofx u julgop uq a wguhp hipl lee moqd ef humaxrqv zrom HasgocmfNofxuqs.hlaageHaszabSajropb(:::).
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.