Skip to content

Instantly share code, notes, and snippets.

@guttentag
Created May 20, 2020 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guttentag/7297ab8a1323891f6f92220d8963f6fa to your computer and use it in GitHub Desktop.
Save guttentag/7297ab8a1323891f6f92220d8963f6fa to your computer and use it in GitHub Desktop.
Inject App version to a label on LaunchScreen.storyboard (2 options)
# Output version numbers into a label on LaunchScreen.storyboard
sed -i "" -e "/userLabel=\"LAUNCH_APP_VERSION\"/s/text=\"[^\"]*\"/text=\"App Version: $MARKETING_VERSION\"/" "$PROJECT_DIR/daytwo/App/View/Base.lproj/LaunchScreen.storyboard"
# Output version & build number to the APP_VERSION label on LaunchScreen.storyboard
versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${INFOPLIST_FILE}")
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}")
sed -i "" -e "/userLabel=\"APP_VERSION\"/s/text=\"[^\"]*\"/text=\"Version: $versionNumber ($buildNumber)\"/" "$PROJECT_DIR/$PROJECT_NAME/Storyboards/Base.lproj/LaunchScreen.storyboard"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment