Can't unwrap optional type with Swift 2.2, Xcode Version 7.3 (7D175)
Please, help! What is going on here?
EDIT1
let localPresenter = presenter
let localDataSource = dataSource
let configurator: ViewControllerConfigurator = { inputView in
let a = inputView as? ChatTableViewController
guard var chatListController = a else {
throw ApplicationErrors.ModuleConfigureError.WrongViewInput
}
localPresenter.view = chatListController
chatListController.presenter = localPresenter
chatListController.tableView.dataSource = localDataSource
}
EDIT2 This code works fine:
let localPresenter = presenter
let localDataSource = dataSource
let configurator: ViewControllerConfigurator = { inputView in
let a = inputView as? ChatTableViewController
if let chatListController = a {
localPresenter.view = chatListController
chatListController.presenter = localPresenter
chatListController.tableView.dataSource = localDataSource
} else {
throw ApplicationErrors.ModuleConfigureError.WrongViewInput
}
}