Introducción al Patrón MVVM
Todo para Uno y Uno para Todos
Arquitectura y Diseño en Apps iOS
Patrones MVC y MVP en Apps iOS
Principios SOLID
Patrón de arquitectura MVVM
Quiz: Introducción al Patrón MVVM
Estructura de un Proyecto con MVVM
Inicio del proyecto y estructura básica MVVM
Paquete Models
Core Data
Paquete Views
ViewModel
Quiz: Estructura de un Proyecto con MVVM
Operaciones CRUD en un proyecto con MVVM
Agregar ToDos (Parte 1)
Agregar ToDos (Parte 2)
Listar ToDos
Actualizar ToDos
Archivar ToDos
Desarchivar ToDos
Eliminar ToDos
Actualizar el estado de los ToDos
Diseño y Validación de Vistas para ToDos
Quiz: Operaciones CRUD en un proyecto con MVVM
Clean Architecture
Introducción a Clean Architecture
Estructura de Clean Architecture
Inicio del proyecto con Clean Architecture
Capa de Datos
Comunicación de red HTTP con TheMovieDB
Capa de Dominio
Capa de Presentación
Integración de Capas
Quiz: Clean Architecture
MVVM y Clean Architecture
Highlights
You don't have access to this class
Keep learning! Join and start boosting your career
In this case, we will focus on how to remove a "to do" using a trash can icon in the user interface and manage it in the ViewModel. This process not only improves the user experience but also optimizes the local database.
To implement the removal functionality, we must follow a series of steps within our ViewModel. Here we explain how to do it:
to_do_to_remove
to temporarily store the "to do" we want to remove.delete
function of the context that handles local storage (Core Data, in this case).to_do_to_remove
to that function to delete it.save_data
function to ensure that the changes are reflected in storage.// Assumes the language used is Swift func deleteAll() { guard let index = all.index(of: all) else { return } let toDoToRemove = all[index] storeContainer.viewContext.delete(toDoToRemove) saveData() }
Once we have configured the delete functionality in the ViewModel, it is important to associate this function to the frontend interactive element, in this case, the trash can icon.
deleteAll()
method within the ViewModel.Careful development of this functionality will not only improve the efficiency of our application but will also offer a much more pleasant and controlled user experience. Keep practicing and running new features to perfect your development skills!
Contributions 0
Questions 0
Want to see more contributions, questions and answers from the community?