metabolist / metatext

A free, open-source iOS Mastodon client.
https://metabolist.org/metatext
GNU General Public License v3.0
727 stars 102 forks source link

Make navigation controllers pop via swipe #148

Closed StephenRadachy closed 2 years ago

StephenRadachy commented 2 years ago

Summary

This PR adds the ability to swipe to pop view controllers within navigation controllers like many other popular Apps.

We do this by creating a subclass of UINavigationController called SwipeableNavigationController, which has all of the gesture code. Then in MainNavigationViewController we swap out the navigation controller init.

Other Information

Shout out to @eoghain for building the reference implementation that I used!

Demo

Screen_Recording_2022-11-12_at_12 00 35_AM

jzzocc commented 2 years ago

Tried this out and it does not dismiss by moving the view with the user's touch and pop after a certain threshold like Twitter and Instagram, but suddenly pops after a small swipe gesture. I'm open to this feature because I do use it in those apps, but there appears to still be some issues with this implementation.

StephenRadachy commented 2 years ago

Tried this out and it does not dismiss by moving the view with the user's touch and pop after a certain threshold like Twitter and Instagram, but suddenly pops after a small swipe gesture. I'm open to this feature because I do use it in those apps, but there appears to still be some issues with this implementation.

Cool I'll keep iterating on it - only tested it in the simulator. Stay tuned!

vollkorntomate commented 2 years ago

I didn't look into your PR in detail, but I remember that I suggested the same feature in the official Mastodon app a while ago. It was eventually added with this commit: https://github.com/mastodon/mastodon-ios/commit/f0658f77f8289fe68bdba49fa71586d21ece09f7. Perhaps you can get some inspiration from it.

StephenRadachy commented 2 years ago

@vollkorntomate thanks for pointing this out! The StackOverflow page they reference eluded me in my research.

@jzzocc ready to review again

jzzocc commented 2 years ago

Thanks so much!