// ok async { [weak self] in for await notification in NotificationCenter.default... { guard let self = self else { break } self... } } // leak! async { [weak self] in guard let self = self else { return } for await notification in NotificationCenter.default... { self... } }
こういうケースは前から結構あったし、async sequenceが出てきた以上無視できないようになったと思う for await
イベント通知パターンだと、ループごとに self
取り出さないと、循環参照になるね。 [guard]
captureだと固定で先頭で取り出すから駄目なのか。