Xcode のプロジェクトフォルダを vscode で開いて cmd+T のシンボル検索で
「一致するワークスペースシンボルがありません」
となる
結論としては Package.swift ファイルが必要だった。
一行目の // swift-tools-version: 6.1も必須
platforms で iOS, macOS を指定するが、Xcodeでの設定と合っていないと文法エラーとなるので注意。
// swift-tools-version: 6.1import PackageDescriptionlet package = Package(name: "SystemSounds",platforms: [.iOS(.v16),],products: [.executable(name: "SystemSounds", targets: ["SystemSounds"]),],targets: [.executableTarget(name: "SystemSounds",path: "SystemSounds" // 相対パスでOK),])
├── Package.swift
├── SystemSounds
│ ├── Assets.xcassets
│ ├── ContentView.swift
│ └── SystemSoundsApp.swift
└── SystemSounds.xcodeproj
├── SystemSounds
│ ├── Assets.xcassets
│ ├── ContentView.swift
│ └── SystemSoundsApp.swift
└── SystemSounds.xcodeproj
ちなみに
~/Library/Application\ Support/Code/User/settings.json に
{
"swift.path.sourcekit-lsp": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp"
}
などを記述すると sourcekit-lsp が動かなくなる
作業ログ
https://grok.com/share/c2hhcmQtMw%3D%3D_4661ec7c-d11c-45b5-be4d-b55849334ce3
https://chatgpt.com/share/6888cdc9-83b8-8013-8cde-ffe03f1cab5f