From the course: iOS Development: Architecture
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Refactoring to MVP: View controller
From the course: iOS Development: Architecture
Refactoring to MVP: View controller
- [Instructor] Instead of accessing the model directly, we moved the model to a dedicated model structure. Besides, we introduced a presenter of class to mediate between the view controller and the model. So, let's switch to the master view controller and start refactoring it. We can now safely delete the objects properly and use a presenter instance instead. Next comes the insert new object method. The view controller doesn't manipulate the model directly. Instead, it relies on the presenter, so let's remove this line. Instead, I'm going to call presenter add entry. Let's continue with the prepare for segueway sender method. We won't pass the date object to the detail view controller. The presenter can return the formatted daytime string so we're going to rather use that. So, I replace this line of code with a call to the presenter subscript. The only issue is that the detail view controller's detail item is of type NS date. So, let's fix this in the detail view controller, instead…
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.
Contents
-
-
-
-
-
Introduction to fundamental architectural design patterns57s
-
(Locked)
The model-view-controller3m 50s
-
(Locked)
The model-view-presenter1m 22s
-
(Locked)
MVP example2m 41s
-
(Locked)
Refactoring to MVP: Model2m 26s
-
(Locked)
Refactoring to MVP: Presenter2m 32s
-
(Locked)
Refactoring to MVP: View controller4m 29s
-
(Locked)
The Model-View-ViewModel pattern1m 15s
-
(Locked)
Implementing one-way binding, part 11m 34s
-
(Locked)
Implementing one-way binding, part 23m 55s
-
-
-
-
-
-
-