Yes, the documentation is incorrect here. The Label
should be given an actual ApplicationToken
, not a binding to it (the "$" character at the start of the parameter). The following would fix the compilation error:
Label(selection.applicationTokens.first!) // <-- compiles, but not useful
but that code isn't really usable, since it would crash if the selection doesn't have any application tokens. An alternative is something like this:
if let applicationToken = model.selectionToDiscourage.applicationTokens.first {
Label(applicationToken)
}
else {
Label("No application", systemImage: "app.dashed")
}