Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Rev 17 | Rev 23 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

//
//  NotificationListViewModel.swift
//  twogetskills
//
//  Created by Efrain Yanez Recanatini on 7/31/22.
//

import Foundation
import SwiftUI


class NotificationListViewModel: ObservableObject
{
    @Published public var notifications = [UserNotificationModel]()
    
    init() {

        fetchAll()
    }

    func fetchAll()
    {
        let userNotificationDao = UserNotificationDao.sharedInstance
        notifications = userNotificationDao.selectAll();
    }
    
    public func removeItem(id: Int) {
        let userNotificationDao = UserNotificationDao.sharedInstance
        userNotificationDao.remove(id: id)
           notifications.remove(at: notifications.firstIndex(where: {  $0.id == id })!)
    }
    
   
}