Using Swift Scripts with Xcode | Kodeco, the new raywenderlich.com

Learn how to run Swift scripts as part of the Xcode build phase, giving you control to configure or validate your app while building your project.


This is a companion discussion topic for the original entry at https://www.kodeco.com/25816315-using-swift-scripts-with-xcode

Hi. Thanks for the great article. I have a question. I saw the Process() inside of shell function. I tried using this function in my project but it says ā€œCannot find ā€˜Processā€™ in scopeā€. I tried finding in the HelloXcode project, but canā€™t find it in there. What do I have to do?

Hello @jamesryu108,
the function shell is intended to be used under macOS only, you canā€™t use it in an iOS project because there is no shell :smiley:
This file is compiled against the macOS sdk with the commands:

xcrun --sdk macosx swiftc -parse-as-library $SCRIPT_INPUT_FILE_0 Scripts/Shell.swift Scripts/OverlayLabel.swift Scripts/ImageOverlay.swift -o CompiledScript