CoreData Swift5 Demo Project iOS

CoreData #swift5


link to download dempo project:-

https://gitlab.com/hiren_syl/todo-coredata



Use Core Data to save your application's permanent data for offline use, to cache temporary data, and to add undo functionality to your app on a single device. To sync data across multiple devices in a single iCloud account, Core Data automatically mirrors your schema to a CloudKit container.


Delete A Core Data Object

// Delete the entity from the context
context.delete(user)

// To delete the entity from the persistent store, call
// save on the context
do {
    try context.save()
}
catch {
    // Handle Error
}

New NSManagedObject Example

// Create a new UserEntity in the
// NSManagedObjectContext context
let user = UserEntity(context: context)

// Assign values to the entity's properties
user.name = "User Name"
user.email = "user@domain.com"
user.age = 32

// To save the new entity to the persistent store, call
// save on the context
do {
    try context.save()
}
catch {
    // Handle Error
}

Comments

Popular posts from this blog

Learn Swift Programming in 1 Day

Firebase Demo Code with Swift5

MUSIC PLAYER - PLAY, PAUSE, NEXT, BACK #Swift5 #XCode