Created
July 31, 2016 23:18
-
-
Save digoreis/6dc666b1b2e4b0572f653f3f117940d4 to your computer and use it in GitHub Desktop.
CreateRouteToTest
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
//Include this in AppDelegate | |
if let window = window where NSProcessInfo.processInfo().arguments.contains("UITestRun") { | |
FlowTestRouter.selectRoute(window, routes: NSProcessInfo.processInfo().arguments) | |
return true | |
} | |
import UIKit | |
class FlowTestRouter { | |
static func selectRoute(window : UIWindow , routes : [String]) { | |
if routes.contains("uitest-list") { | |
let navigationController = UINavigationController() | |
let frame = window.bounds | |
navigationController.view.frame = frame | |
window.rootViewController = navigationController | |
window.makeKeyAndVisible() | |
let owlConf = FlowConfigure(window: nil, navigationController: navigationController, parent: nil) | |
let childFlow = OwlsFlowController(configure: owlConf) | |
childFlow.showType = OwlsFlowController.ShowType.List | |
childFlow.start() | |
} else if routes.contains("uitest-grid") { | |
let navigationController = UINavigationController() | |
let frame = window.bounds | |
navigationController.view.frame = frame | |
window.rootViewController = navigationController | |
window.makeKeyAndVisible() | |
let owlConf = FlowConfigure(window: nil, navigationController: navigationController, parent: nil) | |
let childFlow = OwlsFlowController(configure: owlConf) | |
childFlow.showType = OwlsFlowController.ShowType.Grid | |
childFlow.start() | |
} else if routes.contains("uitest-detail") { | |
let navigationController = UINavigationController() | |
let frame = window.bounds | |
navigationController.view.frame = frame | |
window.rootViewController = navigationController | |
window.makeKeyAndVisible() | |
let owlConf = FlowConfigure(window: nil, navigationController: navigationController, parent: nil) | |
let modelMock = Owl(name: "Name", description: "Description", avatar: UIImage(named: "512px-owly-ambassador")) | |
let childFlow = OwlDetailFlowController(configure: owlConf, item: modelMock) | |
childFlow.start() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment