How to implement the iOS native "Go Back" logic
Question

Most iOS applications have the functionality to go back to the previous page by dragging the left edge of the screen to the right, is there a way to enable this functionality for iOS in my application?

https://lh6.googleusercontent.com/-9PifGbRmhaQ/U7UnyS6vZmI/AAAAAAAACtY/XD6zPe0d6HI/s490/browser-swipe-safari.gif

 

browserswipesafari.gif

mvp_badge
MVP

Hi Alisson,


I have never done that but I imagine you can do that with a couple of existing actions.

My suggestion would be to use SwipeEvents from OutSystemsUI, "hooked" to the LayoutWrapper in the Layout block for example in case you want to have the swipe on the whole screen, and have a handler when the user swipes right:


On the handler, you can set the destination to Previous screen.



If you want to apply this behavior just to iOS, you will need to get the operative system and have an If before the destination. You can the JavaScript API for that (see here how).


Kind Regards,
João

Hi João,

The problem is that I want this behavior only if the user swipes on the (left) edge of the screen, not the whole screen. I thought that Apple had a kind of configuration that I would attach to the action that comes back to the previous screen, I saw this in their website: https://developer.apple.com/documentation/uikit/uiscreenedgepangesturerecognizer but I’m not sure if this is what I want and how to do that.

Thanks in advance,

Alisson

mvp_badge
MVP

Hi Allison,


If the problem is the area where the swipe is applicable, you can control this with the WidgetId input of the SwipeEvents, it should have in the case the widget id of the left edge of the screen as per your use case, instead of my example which would be the container that covers the whole screen:

Another option is to explore the possibility of setting Extensibility Configurations to override the default settings for your mobile app. Following the schema, there is an area for iOS specific preferences:



I don't know exactly the preferences for iOS but if one exists to tackle this, this would be the place to define them.


Kind Regards,
João

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.