Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

iOS 16/17 .destination not working after view is hidden/shown (menu) but it works on iOS 18 #3496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 3 tasks
jerometonnelier opened this issue Nov 14, 2024 · 3 comments
Closed
1 of 3 tasks

Comments

@jerometonnelier
Copy link

Description

Hi everyone,

weird bug here.
I've got a SwiftUI view that represents a Menu (embed inside a UIViewController since the rest of the project is UIKit based) and used along with SideMenu.
I used one of the latest TCA implementation with @Perception.Bindable var store: StoreOf, @Reducer reducers, @ObservableState states, @presents and CasePath macros to push some views onto a NavigationStack.

With iOS 18, everything works fine, I can push some views on the SwiftUI Stack, show the UIKit Rootview of the UIKit core part.
But with iOS17, I get this issue : when I first launch the app, everything works fine the first time I show the menu. I can navigate inside, no worries. But if I close the menu and open it again, no more view is pushed onto the stack (or dismissed for that matter. The action is triggered, the @presents variable is filled, but I never enter the .destination modifier.

Here is the one of the modifiers

.navigationDestination(
                                    store: self.store.scope(
                                        state: \.$taximeterSubMenu,
                                        action: \.taximeterSubMenuAction)) { subStore in
                                            WithPerceptionTracking {
                                                TaximeterMenuView(store: subStore)
                                                    .onAppear { handleNavBar() }
                                            }
                                        }

the Case Path macro

static let taximeterSubMenuCasePath = AnyCasePath<Action, PresentationAction<TaximeterMenuFeature.Action>> (
            embed: { .taximeterSubMenuAction($0) },
            extract: { if case let .taximeterSubMenuAction(value) = $0 { return value } else { return nil } }
        )

Is there some breakpoint I can make or logs to activate to try to see what happens ?
I'll check with the company if it's possible to send the source code, that would be easier.

Thanks

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

No response

Actual behavior

No response

Reproducing project

No response

The Composable Architecture version information

1.15.2

Destination operating system

iOS 17

Xcode version information

Xcode 16.2

Swift Compiler version information

swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Target: arm64-apple-macosx15.0
@jerometonnelier jerometonnelier added the bug Something isn't working due to a bug in the library. label Nov 14, 2024
@jerometonnelier
Copy link
Author

jerometonnelier commented Nov 14, 2024

fyi, I tried to target iOS 17 and remove all WithPerceptionTracking, I get the same result.
I also added some breakpoints inside the

        .ifLet(\.$taximeterSubMenu, action: Action.taximeterSubMenuCasePath) {
            TaximeterMenuFeature()
        }

and

        static let taximeterSubMenuCasePath = AnyCasePath<Action, PresentationAction<TaximeterMenuFeature.Action>> (
            embed: { .taximeterSubMenuAction($0) },
            extract: { if case let .taximeterSubMenuAction(value) = $0 {
                return value
            } else {
                return nil
            } }
        )

I do enter several times inside both, the difference being that the first time, I eventually enter the return value while all other times, I only get the return nil. I hope that can help

@OguzYuuksel
Copy link

OguzYuuksel commented Nov 17, 2024

Hi @jerometonnelier,
Could you provide a sample project repository where the issue can be reproduced so that we can investigate further?
It might be related to the an open PR: #3464
Could you try that branch just to confirm its identity issue?

@mbrandonw
Copy link
Member

Hi @jerometonnelier, as @OguzYuuksel mentioned, a reproducing project is the best way for someone to look into this.

However, the fact that this works in iOS 18 and not 16/17 leads to me to believe it is a SwiftUI bug and probably not related to this library. Because of that I am going to convert this to a discussion for the time being and please feel free to keep the conversation going over there.

@mbrandonw mbrandonw removed the bug Something isn't working due to a bug in the library. label Nov 17, 2024
@pointfreeco pointfreeco locked and limited conversation to collaborators Nov 17, 2024
@mbrandonw mbrandonw converted this issue into discussion #3502 Nov 17, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants