srinadh
srinadh
Sep 4, 2018 · 1 min read

Andy Delarge & Wangdu Lin It is nice article now my code working after i do small fixes. Make sure to remove all the weak refernces from all the classes and follow the following concept

  • The router keeps a weak reference of the view and the presenter.
  • The presenter holds the router and the interactor strongly
  • The interactor keeps a weak refernece of the presenter
  • The view keeps a strong refernece of the presenter

So in this project, FruitListInteractor.swift class must be like following and rest all place remove weak refrence.

class FruitListInteractor: FruitListInputInteractorProtocol {

weak var presenter: FruitListOutputInteractorProtocol?

func getFruitList() {

presenter?.fruitListDidFetch(fruitList: getAllFruitDetail())

}

func getAllFruitDetail() -> [Fruit] {

var fruitList = [Fruit]()

let allFruitDetail = Common.generateDataList()

for item in allFruitDetail {

fruitList.append(Fruit(attributes: item))

}

return fruitList

}

}

    srinadh

    Written by

    srinadh