R.swift
R.swift copied to clipboard
Add R.info for static typing Info.plist
The Info.plist file contains data that is sometimes needed at runtime. In particular, for Siri Shortcuts, I'm interested in the NSUserActivityTypes array.
We should add a top level R.info
object, that includes relevant fields like userActivityTypes
, but also things like applicationShortcutItems
, as mentioned in https://github.com/mac-cain13/R.swift/issues/82
Example usage:
let myOrder: String = R.info.userActivityTypes.comMyAppViewOrder
let barcodeScanner: String = R.info.applicationShortcutItems.comMyAppBarcodeScanner.title
Found this list of keys that you can have in a plist, could be a good starting point/reference: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html
Apple states it's not up to date, but I see keys stated as iOS 11.0 and later
. So it doesn't seem that outdated yet...
Also; think we can use the regular identifier conversion we always use, and from there see if we want to automatically drop the NS
and UI
prefixes for example.
Just noticed that what file will be used as the Info.plist is a build setting. So you can use another plist in debug or release for example. That would make it a bit harder to do this right, we should think about that.
Could we merge the different info.plist files, in the same way we do for different translations of a strings file? If a key doesn't exist in both files, it would emit a warning.