Proyectos de Subversion Iphone Microlearning - Inconcert

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
//
2
//  CommentAndRatingView.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 7/31/22.
6
//
7
 
8
import Foundation
9
 
10
struct CommentAndRatingComment :Identifiable
11
{
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
 
21
}
22
 
23
 
24
class CommentAndRatingCommentsViewModel : ObservableObject {
25
    @Published public var comments : [CommentAndRatingComment] = [CommentAndRatingComment]()
26
 
27
    public func prepend(newComment : CommentAndRatingComment) {
28
        comments.insert(newComment, at: 0)
29
    }
30
 
31
    public func removeItem(id: String) {
32
           comments.remove(at: comments.firstIndex(where: {  $0.id == id })!)
33
    }
34
 
35
}