Comments (10)
i will create a test project and upload it here after work, thanks man!
from swiftui-navigation-transitions.
@izombieprod are you using the latest version of the library (0.13.3)?
If so, please provide a minimal reproducible project that can help me get started debugging the issue.
from swiftui-navigation-transitions.
Hi there! Yes, Im using 0.13.3 version as spm , with your custom zoom transition (but the same bug occurs to me with any transitions, I checked) on Xcode 15.
struct SplashScreenView: View {
@StateObject var viewModel: SplashScreenViewModel
@EnvironmentObject var coordinator: Coordinator
@State private var isVisible = false
typealias ViewModel = SplashScreenViewModel
var body: some View {
NavigationStack(path: $coordinator.steps) {
ZStack {
GradientBackgroundView()
.frame(maxWidth: .infinity, maxHeight: .infinity)
Image(Constants.logos.splashScreen)
.transition(.move(edge: .leading))
}
.navigationDestination(for: ScreenModel.self) { screen in
switch screen.type {
case .login:
GetStartedView(viewModel: GetStartedViewModel())
.toolbar(screen.navigationBarVisible ? .visible : .hidden, for: .navigationBar)
case .swipesExpandedView:
if let screen = screen as? SwipesExpandedViewScreenModel {
FullScreenDetailView(card: screen.card)
.navigationTransition(.zoom)
.toolbar(screen.navigationBarVisible ? .visible : .hidden, for: .navigationBar)
} else {
EmptyView()
}
}
}
}
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
viewModel.checkAuth { screenModel in
coordinator.showNextScreen(screenModel)
}
}
}
}
}
from swiftui-navigation-transitions.
and here's how my coordinator is look like
class Coordinator: ObservableObject {
static let shared = Coordinator()
@Published var steps = [ScreenModel]()
private init() {
}
func showNextScreen(_ screenModel: ScreenModel) {
steps.append(screenModel)
}
func goBack() {
steps.removeLast()
}
func popToRoot() {
steps = [.init(title: "Login", type: .login)]
}
}
class ScreenModel: Identifiable, Hashable {
static func == (lhs: ScreenModel, rhs: ScreenModel) -> Bool {
lhs.id == rhs.id
}
var id: String {
type.id
}
let title: String
let type: CoordinatorStep
let navigationBarVisible = false
init(title: String, type: CoordinatorStep) {
self.title = title
self.type = type
}
func hash(into hasher: inout Hasher) {
hasher.combine(id)
}
}
class SwipesExpandedViewScreenModel: ScreenModel {
let card: SwipeMockCard
init(card: SwipeMockCard, title: String, type: CoordinatorStep) {
self.card = card
super.init(title: title, type: type)
}
}
from swiftui-navigation-transitions.
I'm getting a lot of errors for things that are missing from your example. Could you narrow down the reproducible scenario into a standalone project that can be zipped or put in a repo? Otherwise there are too many gaps to fill to debug effectively.
from swiftui-navigation-transitions.
https://github.com/izombieprod/swiftUItestTransitions - here's a code example with the same transition behavior as I told you in the thread before. the first transition is always the default.
from swiftui-navigation-transitions.
Just wanted to pop in and say that I'm facing the same issue.
from swiftui-navigation-transitions.
Thank you @izombieprod, I'll take a look at this and get back to you shortly.
from swiftui-navigation-transitions.
Oh I see what's going on. So you're tacking the .navigationTransition
modifier onto each detail view expecting them to have different transitions:
.navigationDestination(for: ScreenModel.self) { screen in
switch screen.type {
case .firstView:
FirstView()
.navigationTransition(.zoom)
case .secondView:
SecondView()
.navigationTransition(.slide)
case .thirdDView:
ThirdView()
.navigationTransition(.default)
}
}
However, this is not a supported use case. I'm afraid you're limited to one specific transition per NavigationStack
. Sorry about this, but there's just no way around this. You must pick one transition and apply it to the navigation stack instead of the detail views, as follows:
NavigationStack(path: $coordinator.steps) {
// ...
}
.navigationTransition(.xyz)
from swiftui-navigation-transitions.
@davdroman Understood, thanks
from swiftui-navigation-transitions.
Related Issues (18)
- UI freezing on iOS 17 device HOT 4
- Unable to disable swipe back if use this animation HOT 2
- iOS 17.1 - Navigation animation issues HOT 1
- Navigation bar disappears after rotating device in destination view and coming back HOT 2
- Bump to Swift 5.9 (by April 2024)
- Change fade transient view background color HOT 2
- Dynamic change of interactivity is not supported? HOT 1
- present animation HOT 1
- how to create a 'nothing' transition HOT 1
- slide-inverse
- `ZPosition` Transition
- DocC
- Will there be macOS support? HOT 1
- Change transition ?
- 3D Transitions
- Tests HOT 1
- Error When Archive (Command SwiftCompile failed with a nonzero exit code) HOT 7
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 swiftui-navigation-transitions.