Closed Kharauzov closed 4 years ago
You are using [unowned self]
which is discussed here http://stackoverflow.com/questions/24320347/shall-we-always-use-unowned-self-inside-closure-in-swift
Your approach seems correct.
A temporary solution may be to use fdTakeController = nil
in the deinit. But I don't have any other ideas right now. Hopefully other, more creative people, can find this issue and comment.
@fulldecent Unfortunately, this does not work fdTakeController = nil
. I've tried it before already. Okey, maybe someone else will help. But thanks for the quick reply and help in any way.
Have you tried to use [weak self]
instead? Then you can handle the self
in a week reference cycle. If you want to ensure that self is present without forcing unwrapping then you can instantiate a guard let this = self else { return }
then use your this.someFunc()
when needed. After dismissing the view, the self
retain cycle will be deallocated automatically without holding on any strong reference that could have been captured by the closure
.
That worked for me, hopefully it'll work for you.
This is now in Swift I believe this issue is fixed
Closing for now. Major updates in c3450d12a3aaa2325465935c2efad156d76672de
Please reopen if this can be reproduced in the latest version.
Hello Guys, I have such method to show FDTake at my view controller. Code at my ViewController:
Problem is, that when I go away from my controller, its deinit is being called as it should to be. However I noticed, that deinit of FDTake controller is not called. Could you tell me, maybe I did something wrong at implementation of FDTake at my controller. Because it causes memory leak.