SwiftIndexStore is a IndexStore reader library for Swift.
This library uses libIndexStore to derive data from index directory generated by Xcode. For more information about libIndexStore, and producing raw indexing data, see the Indexing While Building whitepaper.
- swift-renamer: A tool that renames Swift identifiers in project.
To use the SwiftIndexStore library in a SwiftPM project, add the following line to the dependencies in your Package.swift
file:
.package(url: "https://github.com/kateinoigakukun/swift-indexstore", .branch("master")),
If you want to dump the content of IndexStore, you can use index-dump-tool
.
$ swift run index-dump-tool print-record --index-store-path path/to/IndexStore
=============================
Unit: "ViewModel.o-366G7N49CIUXI"
------------------------------
Record: "/Applications/Xcode-11.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/swift/Swift.swiftmodule/x86_64.swiftinterface"
------------------------------
Record: "/var/folders/br/7sr_p7cj7v549x_gtkb33df00000gp/T/tmp.1FkAuTE5/ViewModel.swift"
----------Symbols----------
| usr = s:9ViewModelAACABycfc | name = init() | kind = constructor | subKind = none | language = swift |
| usr = s:9ViewModelAAC | name = ViewModel | kind = class | subKind = none | language = swift |
| usr = s:9ViewModelAAC4nameSSvg | name = getter:name | kind = instanceMethod | subKind = accessorGetter | language = swift |
| usr = s:9ViewModelAAC4nameSSvp | name = name | kind = instanceProperty | subKind = none | language = swift |
| usr = s:9ViewModelAAC4nameSSvs | name = setter:name | kind = instanceMethod | subKind = accessorSetter | language = swift |
| usr = s:SS | name = String | kind = struct | subKind = none | language = swift |
----------Occurrences----------
| roles = Roles(["definition", "implicit", "childOf"]) | usr = s:9ViewModelAACABycfc | location = /var/folders/br/7sr_p7cj7v549x_gtkb33df00000gp/T/tmp.1FkAuTE5/ViewModel.swift:1:7 |
| roles = Roles(["definition"]) | usr = s:9ViewModelAAC | location = /var/folders/br/7sr_p7cj7v549x_gtkb33df00000gp/T/tmp.1FkAuTE5/ViewModel.swift:1:7 |
| roles = Roles(["definition", "implicit", "childOf", "accessorOf"]) | usr = s:9ViewModelAAC4nameSSvg | location = /var/folders/br/7sr_p7cj7v549x_gtkb33df00000gp/T/tmp.1FkAuTE5/ViewModel.swift:2:7 |
| roles = Roles(["definition", "implicit", "childOf", "accessorOf"]) | usr = s:9ViewModelAAC4nameSSvs | location = /var/folders/br/7sr_p7cj7v549x_gtkb33df00000gp/T/tmp.1FkAuTE5/ViewModel.swift:2:7 |
| roles = Roles(["definition", "childOf"]) | usr = s:9ViewModelAAC4nameSSvp | location = /var/folders/br/7sr_p7cj7v549x_gtkb33df00000gp/T/tmp.1FkAuTE5/ViewModel.swift:2:7 |
| roles = Roles(["reference"]) | usr = s:SS | location = /var/folders/br/7sr_p7cj7v549x_gtkb33df00000gp/T/tmp.1FkAuTE5/ViewModel.swift:2:13 |