hotreloading-vscode-ios icon indicating copy to clipboard operation
hotreloading-vscode-ios copied to clipboard

Demonstrating iOS development environment in VSCode using XcodeGen + HotReloading.

trafficstars

SwiftUI iOS Debug & HotReloading in VSCode

Demonstrating vscode development environment using xcodegen + HotReloading.

hotreloading-vscode-ios 2022-06-03 20_10_56

Support HotReloading

One caveat to support HotReloading is to ensure the derivedDataPath passed to xcodebuild matches that when building with Xcode.

Xcode (by default) uses "Unique" build locations for each project: Xcode DerivedData Hashes

Once the xcodegen task has been run the following command can be used to output the $BUILT_PRODUCTS_DIR including the unique location (for this demo):

$xcodebuild -project ./Demo.xcodeproj -scheme Demo -showBuildSettings | grep -m 1 "BUILT_PRODUCTS_DIR" | grep -oEi "\/.*"

Output:

~/Library/Developer/Xcode/DerivedData/Demo-avuzscipzqxczrbltxhlvbnxujdo/Build/Products/Debug-iphoneos

This in turn means the .vscode/launch.json iOS Debug program needs to be updated to resolve to the output *.app ($CODESIGNING_FOLDER_PATH)