Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Rev 11 | | 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 {
25
    @Published public var comments : [CommentAndRatingComment] = [CommentAndRatingComment]()
26
 
11 efrain 27
    public func prepend(newComment : CommentAndRatingComment) {
10 efrain 28
        comments.insert(newComment, at: 0)
29
    }
11 efrain 30
 
31
    public func removeItem(id: String) {
32
           comments.remove(at: comments.firstIndex(where: {  $0.id == id })!)
33
    }
10 efrain 34
 
35
}