Oddbean new post about | logout
 @096d2c53 Pretty sure that's a no, because these are (or at least can be) extracted by the static analyzer. 
 @21f06d90 Fair, it just feels weird I can then pass a dynamic image into the same initializer but not a dynamic string 
 @096d2c53 There's so much voodoo going on in Intents, sometimes I'm scared to know. 
 @21f06d90 @096d2c53 Exactly but it should work if you can make `name` a String.LocalizationValue 
 @72e0970f @21f06d90 "Cannot convert value of type 'String.LocalizationValue' to expected argument type 'LocalizedStringResource'"

😢 
 @096d2c53 @21f06d90 LocalizedStringResource can either be initialized with a raw [static] string, .init(aRawString), or .init(aLocalizationValue).
Would the latter one work? 
 @72e0970f @21f06d90 Sorry, I think I'm missing something key haha. How would that work in this case? My use case is very similar to the example above where I pass a string into the AppIntent struct and I want to use that in the displayRepresentation var 
 @096d2c53 @21f06d90 Using a switch as you did is great to benefit automatic localization export (especially with String Catalog), and detecting that let’s say a new flavor introduced later doesn’t get forgotten for localization.

For automatic export, the compiler needs the string to be declared as a raw string somewhere (or inferred).

I’d use the fact that LocalizedStringResource & String.LocalizationValue are ExpressibleByStringLiteral.

https://files.mastodon.social/media_attachments/files/111/173/756/513/003/073/original/7275c8341d29cbe1.png