How to enable code completion on Coderunner tool for swift language - swift

Any help with swift language code completion on coderunner, would be much appreciated.
On the website https://coderunnerapp.com/ its claimed that it does support it, but not sure if I need to enable it explicitly or if I'm missing something.

Setup Active Directory
In Terminal run
xcrun swift --version
If you see the version information, you’re all set. If the command fails with xcrun: error: unable to find utility "swift", not a developer tool or in PATH, you need to set the active developer directory:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Create a Swift Template in CodeRunner
Open Preferences and switch to the Languages tab. Create a new entry in the list and name it “Swift”.
In the “Run Command:” text field, enter this command:
xcrun swift -sdk $(xcrun --show-sdk-path --sdk macosx) -i $filename
The “Code Template:” field should contain the code you want to start with when you create a blank Swift file in CodeRunner.
In the “File Extension” field, enter swift.

Related

Xcode 14.0 command PhaseScriptExecution failed with a nonzero exit code

After updating my Xcode to the latest version 14.0. I am facing this issue if anyone know how to resolve it please let me know
Click properties on the project, go to build phases and check the option "For install builds only"
Maybe the problem is with "Run script"
Ex: I did change firebase crashlytics from "pod" to "Packeges".
But I not change script.
I have tried all the solutions in
"https://stackoverflow.com/questions/53289524/xcode-10-2-1-command-phasescriptexecution-failed-with-a-nonzero-exit-code"
My solutions is change TARGETS -> Build Phases. In the script field
form
"${PODS_ROOT}/FirebaseCrashlytics/run"
to
"${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run"
In short the problem is your script, do it right
If Scrip is install builds only. U need
Targets -> Build Phases -> Run Scrip -> check "For install builds only"
Ex:
APP_PATH=“${TARGET_BUILD_DIR}/${WRAPPER_NAME}”
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find “$APP_PATH” -name ‘*.framework’ -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read “$FRAMEWORK/Info.plist” CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH=“$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME”
echo “Executable is $FRAMEWORK_EXECUTABLE_PATH”
EXTRACTED_ARCHS=()
for ARCH in $ARCHS
do
echo “Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME”
lipo -extract “$ARCH” “$FRAMEWORK_EXECUTABLE_PATH” -o “$FRAMEWORK_EXECUTABLE_PATH-$ARCH”
EXTRACTED_ARCHS+=(“$FRAMEWORK_EXECUTABLE_PATH-$ARCH”)
done
echo “Merging extracted architectures: ${ARCHS}”
lipo -o “$FRAMEWORK_EXECUTABLE_PATH-merged” -create “${EXTRACTED_ARCHS[#]}”
rm “${EXTRACTED_ARCHS[#]}”
echo “Replacing original executable with thinned version”
rm “$FRAMEWORK_EXECUTABLE_PATH”
mv “$FRAMEWORK_EXECUTABLE_PATH-merged” “$FRAMEWORK_EXECUTABLE_PATH”
done
On my side this issue appeared when i change my computer and issue was caused by Apple Silicon processor. When i start to use m1 pro, i did not check the installation page i directly intalled flutter via Fvm. When i check the installation page i saw there are a few steps to install flutter on Apple Slicon. And these steps fixed the issue;
sudo softwareupdate --install-rosetta --agree-to-license
ref: https://docs.flutter.dev/get-started/install/macos

What does inactive developer path mean in VS Code?

So I am trying to learn C++ and I am using VS Code as my editor, and when I write my code and attempt to compile in the terminal, I get an error message saying "xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun"
What does this mean, and how would I go about fixing this?
Thanks
Did you allready ran xcode-select --install in Terminal ? This will download and install the Command Line Tools package .

Can not import TensorFlow for Swift in Xcode Playground

I'm trying to use Swift for TensorFlow and have followed the directions found here: https://github.com/tensorflow/swift/blob/master/Installation.md
When I go ahead and import TensorFlow as such within a Swift Playground file:
import TensorFlow
I get this error: "The active toolchain is not compatible with playgrounds. libswiftCore.dylib could not be loaded"
I was able to use Swift for TensorFlow within the REPL so I know it should work. Anyone have any ideas as to how to fix this issue? It clearly works as shown in this demonstration: https://www.youtube.com/watch?time_continue=819&v=Yze693W4MaU
Get the latest stable toolchain (e.g. v 0.6), install it, then go to Xcode > File > New > Project > Macos - Command Line Tools (instead of Playground). Additionally, the December 23, 2019 development toolchain—and beyond—should not require switching to the Legacy Build System. More information in this discussion here.
Was running into this as well. Answered in the Google Group - turns out you need to make sure you are creating a macOS playground and not an iOS playground.
I had the same issue and it turns out is the playground type.
From the Google Group reply:
As a synthesis of answers above and my own experience now with the latest May 8, 2020 builds and comments from the Google Group, I find:
SUCCESS
Xcode Project Command-line (as #8bitmp3 answered above)
Command-line swiftc (using the -O argument. Note this is the compiler)
FAILURE
Xcode Playground macOS (as #ian-do originally asked)
Command-line swift (and confirmed by Google Group. Note this is the interpreter)
For those interested in the command-line success (macOS 10.15.4), install the toolchain from here, create the source code file inference.swift per this page, and execute the following:
# Test this command. Expected outcome is your existing Xcode app as show below
$ xcrun -f swift
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
# Switch to the new TensorFlow toolchain you installed
# Mine was located at /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.9.xctoolchain/
# Open the Info.plist file, locate CFBundleIdentifier, and copy the string value
# Mine was com.google.swift.20200507
$ export TOOLCHAINS=com.google.swift.20200507
# Test the switch to your TensorFlow toolchain. Note the different result
$ xcrun -f swift
/Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.9.xctoolchain/usr/bin/swift
# Compile your Swift for TensorFlow source code
$ cd <directory with .swift file>
$ swiftc -O -sdk `xcrun --show-sdk-path` inference.swift
# Run the program
$ ./inference
[[0.68070436]]

Running Swift build in Terminal leading to "Platform Path" errors

I recently reformatted my Mac. Today I tried building a swift executable via Terminal to start a server-side swift project. Here are the commands I've used:
swift package init --type executable
swift build
Upon running swift build, I got the following errors:
xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
I'm running Xcode 8.3.1.
Thanks in advance!
Try fixing the SDK path (yours appears incorrect):
$ xcrun --show-sdk-path --sdk macosx
You might have this result:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Switch the default SDK location by invoking:
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
If that doesn't work then take a look inside the (normal) SDK path:
$ ls -lat /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
You should see the SDK's within that directory; if not you'll need to download them.
Select a version of Xcode which can run the swift build command by running, for instance:
sudo xcode-select -switch /Applications/Xcode-8.3.3.app
Where Xcode-8.3.3 is the name of your Xcode application

Swift.org issue with open source swift project. Error: xcrun: error: unable to find utility "launch-with-toolchain", not a developer tool or in PATH

I am trying to Start Xcode with the custom toolchain and to be enabled to use the open source version of Swift.
Steps are taken from Swift.org
And I receive this error:
xcrun: error: unable to find utility "launch-with-toolchain", not a developer tool or in PATH
The open source Swift toolchain from https://swift.org/download/#apple-platforms requires the latest Xcode 7.2 (currently: beta 4).
The location of the developer directory used by xcrun and other build tools must be set to this Xcode 7.2. This can be done from the command-line
with
sudo xcode-select -s /path/to/Xcode7.2-beta.app/Contents/Developer
or in the Xcode "Locations" preferences: