Ionic 2 / iOS Swipe back not working

Hi,

I’m trying to use iOS swipe back functionality and changed swipe-back-enabled=“true” for <ion-nav>

In the child page navController responds like this:
.isSwipeBackEnabled(): true
.canSwipeBack(): true
.canGoBack(): true

But swiping does nothing (Testing in iOS emulator and Ionic View).

The content for this page is very basic
`<ion-navbar *navbar>
<span *ngIf=“product”>{{product.name}}

Test

swipeEnabled: {{swipeEnabled}}
canSwipeBack: {{canSwipeBack}}
canGoBack: {{canGoBack}} `

I tried setting swipe-back-enabled=“false” for <ion-nav> and it actually still returns the same booleans

Am I missing something or is this a bug / not yet implemented?

1 Like

Has someone managed to get back swiping on iOS to work?

Ionic Version: 2.0.0-alpha.42

Ok, it seems that this is not yet implemented.

I went through the sources and every function related to swipe back in components/nav/nav-controller.ts just returns on the first line. I tried removing these but of course it wasn’t that simple to get it working.

Just checked the code again (much later) and it is implemented.

It still did not work right away when I put, in the App’s constructor, the following line:

this.menuController.swipeEnable(false);

swipes were still revealing the menu…

But that’s because menus have to be “enabled” for the above line to work (see the get() and swipeEnable() functions here). I’m guessing the menu is not enabled in the App’s constructor, but does seem to be enabled and everything works when you put the following, instead, in the constructor:

this.platform.ready().then(() => {
    this.menuController.swipeEnable(false);
});

That disabled swiping the menu.

I noticed this is not working for me on iOS (Everything worked just fine on Android):

<ion-nav [root]="rootPage" #content swipe-back-enabled="false"></ion-nav>

So I just changed it to this and now it works perfectly on both platforms:

<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>

Looks it’s documented now http://ionicframework.com/docs/v2/api/components/nav/Nav/