after upgrading from High Sierra to Mojave Xcode (both versions, 10.1 and 10.2.1) crash on startup with the following message:
Library not loaded: @rpath/libswiftAVFoundation.dylib
Referenced from: /Applications/Xcode.app/Contents/MacOS/Xcode
Reason: image not found
before upgrading to Mojave it was possible to start 10.1, but had no luck starting apps on devices with iOS 12.3.1
The problem was that i extracted the xip on an external ssd drive and then dragged the Xcode package to the program folder.
Extracting the xip in the program folder did the trick that Xcode asked then for installing additional components (probably the ones that were missing) and started up normally after.