Giter Site home page Giter Site logo

Comments (6)

jimmy0251 avatar jimmy0251 commented on May 19, 2024

Navigation Controller is not designed for such requirements, I think you should present the controller if you want to control the animation part.

If you really want to hack, you should be able to do it by forking library and adding this code in NavigationControllerHost.

    private func addTransition(nav: UINavigationController, transitionType type: CATransitionType = .fade, duration: CFTimeInterval = 0.6) {
        let transition = CATransition()
        transition.duration = duration
        transition.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)
        transition.type = type
        nav.view.layer.add(transition, forKey: nil)
    }

and then call this function before pushing or popping the view controller.
For example

        uipilot.onPush = { route in
            addTransition(nav: navigation)

            navigation.pushViewController(
                UIHostingController(rootView: routeMap(route)), animated: false
            )
        }

from uipilot.

iosYash avatar iosYash commented on May 19, 2024

from uipilot.

iosYash avatar iosYash commented on May 19, 2024

from uipilot.

iosYash avatar iosYash commented on May 19, 2024

@jimmy0251 Any update on above question?

from uipilot.

cp-divyesh-v avatar cp-divyesh-v commented on May 19, 2024

@iosYash If you consider HomeRoutes as your route and it has all screens like below case

enum HomeRoutes: Equatable {
    case homeView
    case signIn
    case screenA
    case screenB
}

Then you can get the behaviour you asked like below

struct AppRouteView: View {
    private let pilot: UIPilot<HomeRoutes> 
    
    init() {
        let auth = AuthManager()
        pilot = .init(initial: auth.isLoggedIn ? .homeView : .signIn)
    }
  var body: some View {
 }
}

in this if use is loggedIn then pilot initialised with homeView other wise with signIn view

from uipilot.

iosYash avatar iosYash commented on May 19, 2024

Fixed

from uipilot.

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.