Skip to content

Instantly share code, notes, and snippets.

@AFutureD
Created September 17, 2024 14:16
Show Gist options
  • Save AFutureD/fbde217b9b1e9b3ab7312bc62dc6e5fc to your computer and use it in GitHub Desktop.
Save AFutureD/fbde217b9b1e9b3ab7312bc62dc6e5fc to your computer and use it in GitHub Desktop.
Swift LSP support for iOS on vscode
// .sourcekit-lsp/config.json
{
"swiftPM": {
"triple": "arm64-apple-ios-simulator",
"swiftCompilerFlags": [
"-sdk",
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk",
"-target",
"arm64-apple-ios18.0-simulator"
],
"cCompilerFlags": [
"-isysroot",
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
]
}
}
// .vscode/extensions.json
{
"recommendations": [
"sswg.swift-lang"
]
}
// .vscode/settings.json
{
"swift.SDK": "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk",
"swift.buildArguments": [
"--triple",
"arm64-apple-ios-simulator",
"-Xswiftc",
"-target",
"-Xswiftc",
"arm64-apple-ios18.0-simulator"
],
}
{
"folders": [
{
"path": "."
},
{
"name": "Swift Package Dependencies",
"path": ".build/checkouts"
}
],
"extensions": {
"recommendations": ["sswg.swift-lang"],
},
"settings": {
"files.exclude": {
".build": true,
".swiftpm": true
},
"swift.SDK": "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk",
"swift.buildArguments": [
"--triple",
"arm64-apple-ios-simulator",
"-Xswiftc",
"-target",
"-Xswiftc",
"arm64-apple-ios18.0-simulator"
],
}
}
@AFutureD
Copy link
Author

The configuration does not support *.xcworkspace or *.xcodeproj for now, but it does support Swift Packages.

@AFutureD
Copy link
Author

Later, It may get some idea from xcode-build-server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment