rootstrap / ios-base

Boilerplate for new iOS projects using Swift 5. Provides a handful of functionalities.
https://rootstrap.com/
MIT License
262 stars 63 forks source link

Issue with passing delegation events communicating through VC #199

Closed FreshKtm closed 2 years ago

FreshKtm commented 2 years ago

Setting delegates on Route Navigator always results in delegate being nil. Should this be passed through transition configuration? Even following that it's not working. Can we improve the readme to make the navigation part more clear.

glm4 commented 2 years ago

Hey @FreshKtm , thanks for reporting this. Do you have any piece of code or logs you could share? We will be debugging this, but sounds like the object you are passing as delegate is not held by any other object and might be deallocating.

FreshKtm commented 2 years ago

Hey @FreshKtm , thanks for reporting this. Do you have any piece of code or logs you could share? We will be debugging this, but sounds like the object you are passing as delegate is not held by any other object and might be deallocating.

Can you show the right way to make delegation hold when using AppNavigator?

     AppNavigator.shared.navigate(to: CreateRoutes.showLongPressPopup, with: .sheet, animated: true, completion: {
            let vc = CreateRoutes.showLongPressPopup.screen as? VirtualObjectSelectionViewController
            vc?.delegate = self
        })

Doing this doesn't work neither creating a class level vc object. How can I make the delegate hold its value when its pushed. This could of course be solved with general navigation that we use in general I tested and it worked. I couldn't find perfect implementation of this in any of the documents as well.

This behavior I think is quiet common and should be working. Can you point out why it doesn't work.