Show version of app in launch screen with Swift

You can create a script in Build Phases of your project. But make sure you do a couple of things first.

Go to your LaunchScreen.storyboard ViewController and create your version Label. Make sure to name your label to "APP_VERSION" in Identity Inspector pane -> Document -> Label.

Then go to your project's build phases and create your script by clicking the "+" button in the top left corner, then select "New Run Script Phase" from the pulldown menu and then drag it before "Copy Bundle Resources" phase.

UPDATE: My older answer didn't work in the newest Xcode environment. I've fixed the current issues and refactored the script. I'll update when I have the incrementer working. FYI, make sure you reinstall the app for the updated LaunchScreen.storyboard to show (due to system managing caching of the launch screen in latest versions of iOS).

And here's the final working script with shell: /bin/sh in XCode 11 (Swift 5):

#   ON/OFF Script Toggle (script ON with #, script OFF without #)
#exit 0

#   App vesion / Build version constants

#   Output version & build numbers into a label on LaunchScreen.storyboard
sed -i .bak -e "/userLabel=\"APP_VERSION\"/s/text=\"[^\"]*\"/text=\"$versionNumber($buildNumber)\"/" "$sourceFilePath"

Its not allowed to use any UIViewController in LaunchScreen thus what other applications does is place a UILabel in LaunchScreen xib/Storyboard and write their version number as text.

There might be some work around's, Its still not preferred or allowed by Apple, don't waste your time searching you will get the following error if you tried to set custom class :

error: Illegal Configuration: Launch screens may not set custom classnames

NOTE: What usually apps do is create another LaunchScreen UIViewConttoller directly after the default launch screen with same design and presented without animation, for example to receive some data.

Updated @Repose script

#   ON/OFF Script Toggle (script ON with #, script OFF without #)
#exit 0

#   Increment Build Number Bool (Increment ON with true, increment OFF with false)

#   App vesion / Build version constants
versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$INFOPLIST_FILE")
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")

#   Increment build number
if [ "$shouldIncrement" = true ]; then
    buildNumber=$(($buildNumber + 1))
    /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"

#   Output version & build numbers into a label on LaunchScreen.storyboard
sed -i bak -e "/userLabel=\"APP_VERSION\"/s/text=\"[^\"]*\"/text=\"Version: $versionNumber Build: $buildNumber\"/" "$PROJECT_DIR/$PROJECT_NAME/Base.lproj/LaunchScreen.storyboard"