VIPER - , " " iOS
Interactor. "". "" "", MapPlaceManager/MapPlaceService, , :
canCreateMapPlace
createMapPlace(Details)
getMapPlaceCount
getMapPlaceIDs
getMapPlaceDetails(ID)
canUpdateMapPlace
updateMapPlace(ID, NewDetails)
, , API- , , Interactor, , Interactor. API-, , // , , , . - - /. .
/ - , . , , . -, , , .
, , MapPlaceView MapPlaceEditView, , . , . . , ViewController/Presenter "" "Create, View, Edit" - . , . Front-End .
, , "" . MainMapPlacePresenter/ViewController 3 - , . . , .
CurrentLocationInteractor : 1. " " 2. " ". , Interactor. Front-End. SaveAuthorizationInteractor . . , Interactors , , .
The host does all the user-speaking and decision-making work — they can use the device APIs if they need to, for example. Location service. You can create an abstract interface ILocationServiceand shell implementation, called one LocationService, that will absorb the user's location service - a low-level implementation and platform-specific details.
In terms of implementation: you can:
MainPresenter/MainViewController
On Load - Show MapView along with Buttons for Edit and Create Map Place
MapPresenter/MapViewController
On Load - Show Map
Navigations - login, authorization, create, edit
Interactions - none
MapPlaceCreatePresenter/MapPlaceCreateViewController
On Load - call MapPlaceCreateInteractor.canCreateMapPlace - Response = {AllGood, UserNotLoggedIn, LocationIsNotAuthorized}
Interaction - MapPlaceCreateInteractor.createMapPlace - Responses = {PlaceCreatedSuccessfully}
Navigations - Login, Location Authorization, Back to Main View (With Response - UserLoginNeeded, UserAuthorizationForLocationAccessNeeded)
MapPlaceUpdatePresenter/MapPlaceUpdateViewController
On Load - call MapPlaceUpdateInteractor.canUpdateMapPlace
Interaction - MapPlaceUpdateInteractor.updateMapPlace(ExistingMapPlaceID, NewDetails) - Responses = {PlaceUpdatedSuccessfully}
Navigations - Login, Location Authorization, Back to Main View (With Response - UserLoginNeeded, UserAuthorizationForLocationAccessNeeded)