Comments (6)
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.
from uipilot.
from uipilot.
@jimmy0251 Any update on above question?
from uipilot.
@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.
Fixed
from uipilot.
Related Issues (20)
- Passing state from the router view to subviews HOT 2
- Pilot HOT 1
- Setting initial view HOT 2
- Navigate to a new destination and pop backstack upto the new destination HOT 8
- Showing modal or alert HOT 1
- Pilot PopTo Doesn't Work with Parameters HOT 1
- Push fresh version to CocoaPods Specs HOT 2
- Manual `pop()` causes two routes to be deleted from the stack at once HOT 2
- Is UIPilot working with TabView? HOT 1
- In iOS 15, Navigation bar not hiding in tab screen HOT 2
- SwiftUI ScrollView in UIPilot will get stuck after a while. HOT 1
- NavigationBarTitle Large does not display HOT 2
- Is project dead? HOT 2
- How to manage routes for tab bar based application? HOT 1
- How can I handle push notification tap to redirect to particular route's view if I have multiple routes? HOT 2
- Navigation Titles don't appear in tabs HOT 1
- Can this support be added? HOT 1
- Does this library support macOS? HOT 1
- iPad changing orientation is causing a pop route by the system. UIPilot - root route popped by system HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uipilot.