If my view manager needs to be initialized by a delegate, is there any danger to using it instead without the right to use it?
The use of weak ones, apparently, leads to the probability of failure of functions (see below), although this will not lead to failure.
In any case, the use of invalid in this case is unsafe?
class MyViewController: UIViewController private weak var delegate: MyViewControllerDelegate? init(delegate: MyViewControllerDelegat) { self.delegate = delegate } func foobar { delegate?? }
compared with
class MyViewController: UIViewController private unowned var delegate: MyViewControllerDelegate init(delegate: MyViewControllerDelegate) { self.delegate = delegate } func foobar { delegate.doAction() }
source share