Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

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

Rev Autor Línea Nro. Línea
10 efrain 1
//
2
//  CommentAndRatingView.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 7/31/22.
6
//
7
 
8
import Foundation
9
 
11 efrain 10
struct CommentAndRatingComment :Identifiable
10 efrain 11
{
11 efrain 12
    var id : String = UUID().uuidString
13
    var date : String = ""
14
    var image : String = ""
15
    var fullname : String = ""
16
    var rating : Decimal = 0
17
    var comment : String  = ""
18
    var link_delete : String  = ""
19
 
20
 
10 efrain 21
}
22
 
23
 
24
class CommentAndRatingCommentsViewModel : ObservableObject {
11 efrain 25
    private let appDao = AppDao.sharedInstance
10 efrain 26
 
27
    @Published public var comments : [CommentAndRatingComment] = [CommentAndRatingComment]()
28
 
29
 
30
    public func fetchAll(url : String)
31
    {
32
 
33
    }
34
 
11 efrain 35
    public func prepend(newComment : CommentAndRatingComment) {
10 efrain 36
        comments.insert(newComment, at: 0)
37
    }
11 efrain 38
 
39
    public func removeItem(id: String) {
40
           comments.remove(at: comments.firstIndex(where: {  $0.id == id })!)
41
    }
10 efrain 42
 
43
}