Skip to content

Instantly share code, notes, and snippets.

@andersio
Created October 4, 2016 12:32
Show Gist options
  • Select an option

  • Save andersio/3208fefc43073edcc0428f83ddadb5e4 to your computer and use it in GitHub Desktop.

Select an option

Save andersio/3208fefc43073edcc0428f83ddadb5e4 to your computer and use it in GitHub Desktop.
func testDismissViewController_via_property() {
let expectation = self.expectation(description: "Expected rac_dismissModally to be triggered")
defer { self.waitForExpectations(timeout: 5, handler: nil) }
let presenting = UIViewController()
presenting.view = UIView(frame: .zero)
let presented = UIViewController()
presented.view = UIView(frame: .zero)
_viewController = presented
presenting.present(presented, animated: false) {
presented.rac.dismissAnimated
.events
.observeValues { event in
if case .completed = event {
expectation.fulfill()
}
}
presented.rac.dismissAnimated <~ Property(value: false)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment