Skip to content

Instantly share code, notes, and snippets.

@atanasovdejan
Created July 30, 2018 10:00
Show Gist options
  • Save atanasovdejan/012d1ee35ce964a946d4ad13bec18978 to your computer and use it in GitHub Desktop.
Save atanasovdejan/012d1ee35ce964a946d4ad13bec18978 to your computer and use it in GitHub Desktop.
import UIKit
protocol TestPresentationLogic
{
func presentFetchResults(response: Test.Fetch.Response)
}
class TestPresenter: TestPresentationLogic
{
weak var viewController: TestDisplayLogic?
// MARK: - Presentation logic
func presentFetchResults(response: Test.Fetch.Response) {
// NOTE: Format the response from the Interactor and pass the result back to the View Controller
let viewModel = Test.Fetch.ViewModel(name: response.testObj?.name, date: response.testObj?.date, desc: response.testObj?.desc, isError: response.isError, message: response.message)
if viewModel.isError{
viewController?.errorFetchingItems(viewModel: viewModel)
}else{
viewController?.successFetchedItems(viewModel: viewModel)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment