turbolinks / turbolinks-ios

Native iOS adapter for building hybrid apps with Turbolinks 5
MIT License
881 stars 92 forks source link

Removing "back" on home page #105

Closed tormjens closed 7 years ago

tormjens commented 7 years ago

Hi,

I'm just starting out with this library and so far I'm loving out. I'm not that experienced in iOS-development, meaning I've mostly just played around and created errors.

However, I feel this library really solves many of the headaches I've had, and works perfectly for my skillset.

I've encountered an issue though. Once I visit the home page I expect the "back-button" to be removed from the Navigation Bar, but it does not. I've tried using data-turbolinks-action="replace" on the link, and also I've tried adding that all links that resolve to / should replace the view controller and pop it (whatever that means):

fileprivate func presentVisitableForSession(_ session: Session, url: URL, action: Action = .Advance) {
        let visitable = ViewController(url: url)
        if url.path == "/" {
            popViewController(animated: false)
            pushViewController(visitable, animated: false)
        } else {
            if action == .Advance {
                pushViewController(visitable, animated: true)
            } else if action == .Replace {
                popViewController(animated: false)
                pushViewController(visitable, animated: true)
            }
        }

        session.visit(visitable)
    }

However, this only removes the animation part of changing the view. The navigation bar still shows a back button. I want it gone. Is this achievable?

I maybe thought https://github.com/turbolinks/turbolinks-ios/issues/81 would be somewhat relatable, but I'm not sure.

Any pointers or help towards the right direction would be greatly appreciated.

tormjens commented 7 years ago

Probably too quick. Solved it via #81. Embarassing!