Proyectos de Subversion Iphone Microlearning - Inconcert

Rev

Autoría | Ultima modificación | Ver Log |

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

import Foundation

struct CommentAndRatingComment :Identifiable
{
    var id : String = UUID().uuidString
    var date : String = ""
    var image : String = ""
    var fullname : String = ""
    var rating : Decimal = 0
    var comment : String  = ""
    var link_delete : String  = ""
    

}


class CommentAndRatingCommentsViewModel : ObservableObject {
    @Published public var comments : [CommentAndRatingComment] = [CommentAndRatingComment]()

    public func prepend(newComment : CommentAndRatingComment) {
        comments.insert(newComment, at: 0)
    }
    
    public func removeItem(id: String) {
           comments.remove(at: comments.firstIndex(where: {  $0.id == id })!)
    }

}