You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an interesting situation that has been driving me nuts for a day or two that I'd like to solve.
The issue arises when trying to dispatch an action within either an @IBAction function for a tap recognizer or within the UITextfield delegate function shouldChangeCharactersIn.
Some things to note are:
Both functions are in the same view controller which is subscribed to the state.
The state is working, since other view controllers are dispatching actions correctly.
The subscribed controller in question is returning values via the newState() function.
There are no project build errors, but this issue creates an unwanted behavior.
Had the issue with ReSwift 3.0.0. Updated to 4.0.1 and still the same issue.
More than likely this is all happening on the main thread for this controller.
I suspect it's a fault at my end, and not a direct issue with the ReSwift code.
For example, this function works fine as is, until trying to use the store.dispatch line.
When this line is uncommented, the tap won't fire at all.
Where this code in the shouldChangeCharactersIn function works as intended, but if the store.dispatch lines are uncommented, any text input of the textfields is prevented.
Hard to say without looking at the rest of the code. Like, what happens on state updates? Do they override the view/view controller data in a weird way?
I'd try 2 things to find the problem:
Dispatch an irrelevant action, like struct TracerAction: ReSwift.Action { } to see if the dispatching is the problem, or the state updates (this unrecognized action should not result in state changes but may trigger still subscribers)
Disable consumption of state updates in subscribers (e.g. newState is still called by the library but does not update the view)
I have an interesting situation that has been driving me nuts for a day or two that I'd like to solve.
The issue arises when trying to dispatch an action within either an
@IBAction
function for a tap recognizer or within the UITextfield delegate functionshouldChangeCharactersIn
.Some things to note are:
newState()
function.For example, this function works fine as is, until trying to use the
store.dispatch
line.When this line is uncommented, the tap won't fire at all.
Where this code in the
shouldChangeCharactersIn
function works as intended, but if thestore.dispatch
lines are uncommented, any text input of the textfields is prevented.Some things to note for this are:
print
statements are temporary, and are outputting the expected text.switch|case
is for the two textfields in the view controller.If the
store.dispatch
lines are uncommented this behavior happens:Any help or suggestions of a solution would be great, thanks.
--mike
The text was updated successfully, but these errors were encountered: