I have multiple view controllers with a strong reference to a subclass of NSObject. Each view controller allows the user to mutate this object in some fashion and then passes the object to the next view controller. Once completed the user can commit these changes and start the process all over with a new instance of the NSObject subclass. The problem I am experiencing is that some of the view controllers on the stack are retaining the reference to the committed instance.
I have tried using weak, and unsafe_unretained but that makes it difficult to pass the object between view controllers.
I basically need to dealloc an instance of the object once committed, so that any view controllers' reference to it will be nil. However, ARC doesn't allow explicit calls to dealloc.
I can solve this using NSNotificationCenter or by using a delegate, but is there a cleaner way of doing this?
Any insight would be very much appreciated. Thanks!