Multiple destinations UIKit #2390
Replies: 5 comments
-
Hi @nickmalevich, can you please provide a minimal reproducing project that demonstrates the memory leak? |
Beta Was this translation helpful? Give feedback.
-
Hi @mbrandonw, you can see my example project on this repo https://github.com/nickmalevich/DestinationTCA. |
Beta Was this translation helpful? Give feedback.
-
Hi @nickmalevich, the two demos you have provided do not function the same for me. In the I'm not sure this is an issue with the library currently, and so I am going to convert it to a discussion. Please follow up with any findings over there. |
Beta Was this translation helpful? Give feedback.
-
I used this discussion as a reference for managing the destination in UIKit world. I believe the memory leak comes from using the same cancellables set inside the destination ifLet. Having two destinations. Hitting just the first one repeatedly - everything works as expected. Hitting the second destination, it is pushed multiple times. The cancellables registered inside destination scope ifLet are sticking around. I added destinationCancellables that is used inside destination scope ifLet and cleared in destination scope else, and multiple pushes are not happening. I believe this is an application bug. |
Beta Was this translation helpful? Give feedback.
-
I think the comment above is correct - capturing the cancellables set inside the other FWIW, I don't think you need to store the cancellables returned by the inner |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I couldn't find an example of implementing multiple destinations in UIKit. There are no problems with this in SwiftUI.
I've written an implementation that does what it needs to do, but there are memory leaks
Checklist
main
branch of this package.Expected behavior
I want to implement the transition from the parent view controller to several child
Actual behavior
This is my implementation of the parent feature
This is my implementation of handling destination in the UIViewController
To return from a child view controller, I use dismiss(). Indeed, all transitions work, however, there is a memory leak every time the return to the parent view controller occurs.
This can also be observed by calling the push or present methods each time twice as much as the previous one.
Steps to reproduce
To reproduce this bug, you just need to go to the child view controllers and return
The Composable Architecture version information
0.58.0
Destination operating system
iOS 16.6
Xcode version information
14.3.1
Swift Compiler version information
Beta Was this translation helpful? Give feedback.
All reactions