Last active
July 30, 2018 09:48
-
-
Save atanasovdejan/a0142a402f134d76fa42e90efbdc853d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
protocol TestBusinessLogic | |
{ | |
func fetchItems(request: Test.Fetch.Request) | |
} | |
protocol TestDataStore | |
{ | |
//var name: String { get set } | |
} | |
class TestInteractor: TestBusinessLogic, TestDataStore | |
{ | |
var presenter: TestPresentationLogic? | |
var worker: TestWorker? | |
//var name: String = "" | |
func fetchItems(request: Test.Fetch.Request) { | |
if request.itemId == nil || request.count == nil || request.keyword == nil { | |
return self.presenter?.presentFetchResults(response: Test.Fetch.Response(object: nil,isError: true, message: "Fields may not be empty.")) | |
} | |
worker = TestWorker() | |
worker?.fetch(name: request.name, type: request.type, count: request.count, success: { (object) in | |
self.presenter?.presentFetchResults(response: Test.Fetch.Response(object: object, isError: false, message: nil)) | |
}) { (error, message) in | |
self.presenter?.presentFetchResults(response: Test.Fetch.Response(object: nil, isError: true, message: message)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment