R.swift: Add R.info for static typing Info.plist

Created on 7 Jun 2018  路  3Comments  路  Source: mac-cain13/R.swift

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
enhancement

Most helpful comment

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.

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aliasdoc picture aliasdoc  路  3Comments

mac-cain13 picture mac-cain13  路  5Comments

romk1n picture romk1n  路  6Comments

serejahh picture serejahh  路  4Comments

Przemyslaw-Wosko picture Przemyslaw-Wosko  路  4Comments