-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dismiss modally #101
Dismiss modally #101
Conversation
de8e224
to
88becfa
Compare
Adding in @ikesyo for feedback. |
c015b96 fixes the issue! You can now observe both: viewController.rex_dismissModally <~ SignalProducer(value: (true, nil))
viewController.dismissViewControllerAnimated(true, completion: nil) |
I like the ideia and seems something that can be quite useful. However, I would suggest two small changes:
In case of positive feedback we can adopt this approach to other operations like UINavigationControllers's |
@dmcrodrigues pushed with |
c3d6437
to
63bb581
Compare
expectation.fulfill() | ||
} | ||
|
||
viewController.rex_dismissModally <~ SignalProducer(value: (true, nil)) | ||
viewController.rex_dismissAnimated <~ SignalProducer(value: (true, nil)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can be explicit about the parameters of the tuple (sometimes tests are used as usage reference).
# Conflicts: # Rex.xcodeproj/project.pbxproj # Source/UIKit/UIViewController.swift # Tests/UIKit/UIViewControllerTests.swift
What's in this PR
This idea originated from a conversation with @dmcrodrigues, where things like
popToRootViewController
and other ways of manipulating the UI flow, always end with a side effect (startWith
andobserve
methods family). This PR an attempt to make these situation, more idiomatic and declarative.API
Currently it's using
MutableProperty<(Bool, (Void -> Void)?)?>
, theBool
is for theAnimated
flag and the(Void -> Void)?
for the completion closure. I make the whole tuple an optional to address theinitial
value of aMutableProperty
(in this case the initial value isnil
).So I would appreciate some feedback on it. cc @mdiep @iv-mexx
How to use it
Currently one would do the following:
With this PR:
Caveat (
Help needed)There also the cases where one wants to observe the dismiss of a
UIViewController
:via:
I wasn't able to make this work. I tried the following:
This will actually break the test, but it will make the
viewController.dismissViewControllerAnimated(true, completion: nil)
work.Edit1: This seems to be fixed on c015b96