John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 987 forks source link

Navigate(Push or Go) to each TabBarItem or specific views which was inside revealViewController to fontViewController #646

Closed thihaaung6245 closed 7 years ago

thihaaung6245 commented 7 years ago

I have UITabBarController implemented with SWRevealViewController.Like this one.

https://github.com/John-Lluch/SWRevealViewController/files/254044/SWTabBarSwift.5.zip

So,How do i navigate to specific screen or tab from AppDelegate due to DeepLinking Support

iDevelopper commented 7 years ago

Sorry, I don't understand your question!

thihaaung6245 commented 7 years ago

Means I want to navigate(push or instantiate) screens from AppDelegate which you posted on example.You show me how to navigate view controller which was in left menus and each tabItem.

Cause my app will start include DeepLinking support which will read URLScheme and set some condition at AppDelegate openUrl() method. And then navigate due to its URLScheme

I can provide some example if u need to.I mean i will post comment there where i want to do such procedure

iDevelopper commented 7 years ago

Sorry but what does it mean to navigate from AppDelegate? AppDelegate is not a view controller. Can you specify and say exactly what you want to do?

thihaaung6245 commented 7 years ago

Exactly, navigate from AppDelegate openUrl method where we read URLScheme.Was it possible? or else shall we use NSNotificationCenter?I know AppDelegate is not a ViewController.But, we can instantiate RevealViewController there right?

Actually I want to navigate to specific view which i have to say in your example...

1.I want to go to one of the TabItem(Item 2 or 1) 2.I want to go to Item1 or Item2 which was at slide menu.

All these procedure must be done on AppDelegate (openURL) method and inside i will catch openURl scheme data and navigate to specific screen when the app open from Deep Link.

I hope you understand the process of DeepLink. Sorry about my bad english which might make u confuse.

iDevelopper commented 7 years ago

Needs further explanations, sorry

thihaaung6245 commented 7 years ago

ok,I will post an example here.Please wait

iDevelopper commented 7 years ago

Yes and what is your problem? What did you try? You have simply to register your URLs types in the Info tab of your target ( Info -> URLs types -> + ).

And implement:

    func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
        print("\(url)")
        let revealController = window?.rootViewController as! SWRevealViewController
        let tabBarController = revealController.frontViewController as! UITabBarController
        if url.host == "item" {
            if url.path == "/item1" {
                tabBarController.selectedIndex = 0
            }
            if url.path == "/item2" {
                tabBarController.selectedIndex = 1
            }
        }
        return true
    }