AutorÃa | Ultima modificación | Ver Log |
//// CommentAndRatingView.swift// twogetskills//// Created by Efrain Yanez Recanatini on 7/31/22.//import Foundationstruct CommentAndRatingComment :Identifiable{var id : String = UUID().uuidStringvar date : String = ""var image : String = ""var fullname : String = ""var rating : Decimal = 0var 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 })!)}}