DisplayRepresentation wants me to give it an image created using a string literal for systemName.
I can see why it needs this.
However, elsewhere in my code I have a bunch of static constants defined (in an extension on String). I use these so that I can specify the icon for any given concept in a single place, even if it is used in multiple user interface elements.
For example, I can say systemName: .navigateToItemsIcon instead of systemName: "note.text".
It irks me that I can’t use my constants in my display representation definitions.
In an ideal world, the compiler should be able to work out that String.navigateToItemsIcon resolves to a known value at compile time, and treat it the same way as it would treat a string literal.
If your strings are constant anyways declares them as StaticString. As an alternative you could instead extend the type that use the constant like Image.systemBack instead of Image(systemName: .systemBack)
You can even combine the two methods extracting strings to constants and then using those constants to build common usage.
What do you mean by can't here? Does it actually not work (ignoring the warning)?
I could see that you can't use anything but a string literal for the title parameter though (as it ends with a compilation error if you try to use anything else).