Simple Memo App with Uikit & Swiftui
Data renewal
viewWillAppear -In the sheet form that supports from iOS13 to default, it cannot be used.Notification (observer pattern)If there is a place that does not give constraint in Storyboard, a red line will appear.
Core data
Framework for preserving and caching data inside the terminal
Tasks that cause UI blocks can be run in the background
Helps to match the view between the view (table view, collection view, etc.) and the data
It is easy to create data crud without the need for DB management and easy for version management.
Core Data Stack
NSPersistentContainer model, context, coordinatorDelegate
Escaping Closure (Swift)
self in the escape closure, the self must be explicitly displayed or included in the capture list. In addition, in the case of the escape closure, the Weak Reference should be included in the capture list so that the memory rick does not occur due to strong reference.Strong reference cycle (swift)
Even if the variable is declared as NIL by strong reference between two or more instances, the ARC is not 0, so the memory leak is generated without being released.
Solution
Use weak reference
Variables or properties allocated before declaring weak keywords have a weak reference, so when you declare a variable that strongly refer to that instance as NIL, the ARC can be released without stopping.
Use of smile
Unlike the Weak Reference, it is used in the same or longer than the life of an instance. Unlike weak reference, it is used when it is expected to always refer to the value.