Skip to content

Instantly share code, notes, and snippets.

@eastari
Last active September 21, 2017 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eastari/157dbfb14fb36e0d133a2c42e02366fc to your computer and use it in GitHub Desktop.
Save eastari/157dbfb14fb36e0d133a2c42e02366fc to your computer and use it in GitHub Desktop.
class PanelAssembly {
class func createModule() -> PanelModuleInput {
let presenter = PanelPresenter()
let interactorMidi = PanelInteractorMidi()
let interactorInstrument = PanelInteractorInstrument()
let router = PanelRouter()
let soundManager = SoundManager()
presenter.interactorMidi = interactorMidi
presenter.interactorInstrument = interactorInstrument
presenter.router = router
interactorMidi.output = presenter
interactorMidi.soundManager = soundManager
soundManager.output = interactorMidi
interactorInstrument.output = presenter
router.presenter = presenter
if isPhone {
let vc = initializeViewController_phone()
presenter.view = vc
vc.output = presenter
router.viewController = vc
} else {
let vc = initializeViewController_pad()
presenter.view = vc
vc.output = presenter
router.viewController = vc
let recordManager = RecordManager()
interactorMidi.recordManager = recordManager
}
return presenter
}
private class func initializeViewController_phone() -> PanelViewController_iPhone {
let panelStoryboard = UIStoryboard(name: "Panel_iPhone", bundle: nil)
let mainViewController = panelStoryboard.instantiateViewController(withIdentifier: "PanelViewController_iPhone") as! PanelViewController_iPhone
return mainViewController
}
private class func initializeViewController_pad() -> PanelViewController {
let panelStoryboard = UIStoryboard(name: "Panel", bundle: nil)
let mainViewController = panelStoryboard.instantiateViewController(withIdentifier: "PanelViewController") as! PanelViewController
return mainViewController
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment