Coder Social home page Coder Social logo

Jump to proper tab in navigation about dev-ios HOT 6 CLOSED

forem avatar forem commented on June 24, 2024
Jump to proper tab in navigation

from dev-ios.

Comments (6)

SheldonNunes avatar SheldonNunes commented on June 24, 2024

I am sure we can hook into the func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) function in and inspect the intended uri for any of the tab links.

My question would be on the intended behavior around the back button. It looks as though there is currently separate WKWebView instances for each page so would lose the history when we change the tab.

If we did share the history between pages if someone navigates back would we expect the tab to change again?

from dev-ios.

chickdan avatar chickdan commented on June 24, 2024

That's a good question. My first thought is it would move to a new tab, then load the page as part of that tab so there would be back button to take you back to the main page of the current tab.

So say I'm in Connections, I click a link that sends me to Notifications it would move to that tab, then push to the navigation stack for the Notifications tab. If I hit the back button it would go back to the main screen for Notifications. If I tap onto the Connections tab, it will be where it left off (as if nothing happened basically). Does that make sense?

from dev-ios.

SheldonNunes avatar SheldonNunes commented on June 24, 2024

Yeah that makes sense.

I had a look into this and it seems like we can't leverage the WKNavigationDelegate functions (like the one I referenced) as we aren't always initiating a full page reload. We have to use Key Value Observer pattern on the url property of webview to detect all url changes. However that means we only really intercept the event after it has occurred which would mean we would have to do a navigate backwards before changing tabs.

Seems a bit messy/hacky

Thoughts?

from dev-ios.

jessleenyc avatar jessleenyc commented on June 24, 2024

Additional links we'd want this behavior for is /connect and /search and maybe /new

from dev-ios.

SheldonNunes avatar SheldonNunes commented on June 24, 2024

Haven't been able to find an alternative to creating an observer on the url and undoing the navigation before going to a new tab. It is fairly quick but the back icon (if not already showing) does flash before the switch :\

Any ideas/suggestions welcome!

from dev-ios.

benhalpern avatar benhalpern commented on June 24, 2024

Closing because out of date

from dev-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.