Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

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

Rev Autor Línea Nro. Línea
1 efrain 1
//
2
//  NotificationListViewModel.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 7/31/22.
6
//
7
 
8
import Foundation
9
import SwiftUI
10
 
11
 
12
class NotificationListViewModel: ObservableObject
13
{
14
    @Published public var notifications = [UserNotificationModel]()
15
 
16
    init() {
17
 
18
        fetchAll()
19
    }
20
 
21
    func fetchAll()
22
    {
23
        let userNotificationDao = UserNotificationDao.sharedInstance
24
        notifications = userNotificationDao.selectAll();
25
    }
26
 
22 efrain 27
    public func removeItem(id: Int) {
28
        let userNotificationDao = UserNotificationDao.sharedInstance
29
        userNotificationDao.remove(id: id)
30
           notifications.remove(at: notifications.firstIndex(where: {  $0.id == id })!)
31
    }
32
 
1 efrain 33
 
34
}