Observe object's deinit from outside of object
- I want to observe deinit of target object, but there are cases where I can't implement deinit. Therefore, I made
DeinitObserver
. - Swift κ°μ²΄ μΈλΆμμ κ°μ²΄κ° ν΄μ λλ κ² κ°μ§νκΈ°
- In your Xcode project, navigate to File > Swift Packages > Add Package Dependancy...
- Paste the following into the URL field: https://github.com/cozzin/DeinitObserver
import DeinitObserver
DeinitObserver(for: target) {
print("target did deinit!")
}.observe()