Skip to content
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

Added new property - useful when is added to a view controller that… #149

Merged
merged 1 commit into from
Oct 1, 2019
Merged

Conversation

benpackard
Copy link
Contributor

Fix for #148

…s presented modally on iOS 13 where the default presentation style supports a dismiss gesture.
@evgenyneu evgenyneu merged commit 2d0356d into evgenyneu:master Oct 1, 2019
@evgenyneu
Copy link
Owner

Thank you very much! Excellent work. I've released your changes in version 20.0.1. Please let me know if there are still any issues.

@benpackard
Copy link
Contributor Author

Oh dear - I seem to have missed something somewhere. Once I updated to 20.0.1 and set the new flag disablePanGestures to true there is no change in behavior in my app.

It seems that gestureRecognizerShouldBegin is never called. Which is strange, because when I subclass CosmosView and override it, it is called. In other words, this works:

private class FixedCosmosView: CosmosView {
	override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
		print("gesture") // this is printed
	}
}

But this (the implementation used in recent commit) does not:

@IBDesignable open class CosmosView: UIView {
...
    override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
		print("gesture")
    }
...
}

I'm not sure why it would work in a subclass, but not in the CosmosView class itself.

@evgenyneu
Copy link
Owner

Hmm, that's good to know. I've made a demo and it seems to work for me (tried both with simple file installation and CocoaPods):

CosmosModalDemo.zip

Let me know if the demo works for you. Maybe there is something else that is causing the issue?

By the way, in your code example above, I noticed that you wrote gestureRecognizerShouldBegin without open:

open override func gestureRecognizerShouldBegin...

I can see that we use open currently. Is that code snippet above taken from 20.0.1 code?

@benpackard
Copy link
Contributor Author

benpackard commented Oct 1, 2019

Thanks for the demo, I can confirm that it works for me so now I'm going through my own project to see what differs.

As for the snippet, the second piece of code is just a quick log statement I used to see if the delegate function is even called. Using the 20.0.1 release, I replaced the same function with this snippet and found that nothing is logged when I use the CosmosView. Whereas when I subclass CosmosView and override the function there, the log appears. Very strange.

Perhaps something to do with the fact I am adding it programmatically vs using a storyboard. Hopefully I will have some more information soon.

The good news at least is that the commit added in 20.0.1 is fit for purpose.

@evgenyneu
Copy link
Owner

evgenyneu commented Oct 1, 2019

Perhaps something to do with the fact I am adding it programmatically vs using a storyboard. Hopefully I will have some more information soon.

That's possible. I think we can test this by modifying my demo and creating cosmos view programmatically.

@benpackard
Copy link
Contributor Author

benpackard commented Oct 1, 2019 via email

@benpackard
Copy link
Contributor Author

I'm sorry for the confusion - this morning with a clear head I went back to basics and cleaned all my build folders and derived data and now everything is working well.

Thanks for helping me figure it out and for merging the PR, which seems to work well in my project!

@evgenyneu
Copy link
Owner

No worries, I'm glad that it's working for you now. The caching of stuff in Xcode can be frustrating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants