Это не работает sendSwipeNotification(post: Poster, swipedRight: true)
.
При вызове функции (в данном случае) следует ожидать, что ей будет передан заполненный объект, а не класс объекта или сама структура (структура Poster)в данном случае)
Другими словами, вы отправляете фактическую модель Struct в sendSwipeNotification, тогда как вы должны создавать объект структуры из модели Struct, заполняя его и передавая этот объект.
Так например
@objc func handleLike() {
let createdByUserId = //get the id of who created the post (?)
let myPostToPass = PostStruct(fromId: createdByUserId, postText: "hello!")
//pass the created myPostToPass poster object
sendSwipeNotification(post: myPostToPass, swipedRight: true)
}
, а затем
func sendSwipeNotification(post: PostStruct, swipedRight: Bool) {
guard let currentUser = Auth.auth().currentUser?.uid else {return}
let fromId = post.fromId
let msg = post.postText
guard let cardID = topCardView?.cardViewModel.uid else { return }