New a fragment instance in Kotlin style.
Customize View by yourself, you must inherit View class. For the View class, it must run this three methods in flow. Brief describe as below
- onMeasure(): Set the layout size.
- onLayout(): Set the layout position.
- onDraw(): Draw the layout content.
Before the flow, I will explain a little the constructor of View or ViewGroup. Normally, there are three constructor we need to override.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DataController: NSObject { | |
var managedObjectContext: NSManagedObjectContext | |
override init() { | |
// This resource is the same name as your xcdatamodeld contained in your project. | |
guard let modelURL = Bundle.main.url(forResource: "YOUR_CORDDATA_NAME", withExtension: "momd") else { | |
fatalError("Error loading model from bundle") | |
} | |
// The managed object model for the application. It is a fatal error for the application not to be able to find and load its model. |