This is my modifier for a view, I want to display the SF symbols by using systemImage: "heart.fill"
instead of "-"
and systemImage: "heart"
instead of "+"
but XCode myseriously fails to build without any error.
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button(favorites.contains(item) ? "-" : "+") {
if favorites.contains(item) {
favorites.remove(item)
} else {
favorites.add(item)
}
}
}
}
How do I print the SF symbol instead of a String? Thanks in advance.