This repository was archived by the owner on Sep 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Make an Info.plist template for UIAppFonts #70
Copy link
Copy link
Open
Description
It would be nice to have a template able to auto-generate the content of the UIAppFonts key.
People could then generate the partial plist using swiftgen, then use e.g. PlistBuddy to merge that with their actual Info.plist:
# Generate the partial plist containing the entries for UIAppFonts
swiftgen fonts -t InfoPlist Resources/Fonts -o UIAppFonts.plist
# Delete any potential UIAppFont entry from Info.plist, then create a fresh one and merge it with the generate list
/usr/libexec/PlistBuddy -c "Delete UIAppFonts" -c "Add UIAppFonts array" -c "Merge UIAppFonts.plist UIAppFonts" "$INFOPLIST_PATH"(Note: The second step here is automated using PlistBuddy, but in practice the developer might prefer just doing that step manually, by opening the UIAppFonts.plist file in Xcode, and copy/pasting that entry in their Info.plist manually)
The template to generate the UIAppFonts plist could look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>{% for fam in families %}{% for font in fam.fonts %}
<string>{% if param.useRelativePath %}{{font.path}}{% else %}{{font.path|basename}}{% endif %}</string>
{% endfor %}{% endfor %}</array>
</plist>