Skip to content

Instantly share code, notes, and snippets.

# Xcode 10.1
{
"key.hash" : "TKPSNCTWPEQW",
"key.dependencies" : [
{
"key.kind" : "source.lang.swift.import.module.swift",
"key.hash" : "1WTOKLWFGHV0G",
"key.is_system" : true,
"key.filepath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault.xctoolchain\/usr\/lib\/swift\/macosx\/x86_64\/Swift.swiftmodule",
# 10.2 beta 2
{
"key.entities" : [
{
"key.kind" : "source.lang.swift.ref.module",
"key.column" : 8,
"key.name" : "Foundation",
"key.line" : 1,
"key.usr" : "c:@M@Foundation"
# 10.1
{
"key.dependencies" : [
{
"key.is_system" : true,
"key.hash" : "F205OQLFSHXT",
"key.name" : "Swift",
"key.filepath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault.xctoolchain\/usr\/lib\/swift\/macosx\/x86_64\/Swift.swiftmodule",
"key.kind" : "source.lang.swift.import.module.swift"
{
"key.entities" : [
{
"key.kind" : "source.lang.swift.decl.protocol",
"key.name" : "FixtureProtocol100",
"key.line" : 4,
"key.column" : 10,
"key.entities" : [
{
"key.kind" : "source.lang.swift.decl.var.instance",
import Foundation
import Cocoa
protocol FixtureProtocol100 {
var someGetSetVar: Bool { get set }
}
extension FixtureProtocol100 {
var someGetSetVar: Bool {
get { return false }
{
"key.entities": [
{
"key.column": 7,
"key.usr": "s:25PeripheryKitTestsFixtures14FixtureClass95C",
"key.kind": "source.lang.swift.decl.class",
"key.line": 4,
"key.entities": [
{
"key.entities": [
import Foundation
class FixtureClass95 {
private static var someVar: String!
private var someVar: String! {
return FixtureClass95.someVar
}
}
import Foundation
import XCTest
enum AnError: Error {
case boom
}
class LogCrashTest: XCTestCase {
func testUnderlyingSwiftError() {
let userInfo: [String: Any] = [

Identifying compiler arguments for SourceKit's 'indexsource' request type.

SourceKit's 'indexsource' request type requires swiftc compiler arguments in order to compile the given source file on demand (I assume). However, the exact arguments required are numerous, not documented and highly specific to the requested source file.

Advanced users of 'indexsource' do not typically attempt to construct this set of arguments manually, and instead 'spy' on Xcode in order to determine the necessary arguments. Both SourceKitten[1] and Periphery[2] rely upon parsing the output from xcodebuild to identify the appropriate swiftc call, parse the argument set, and then remove specific arguments that 'indexsource' does not appear to accept[3].

This approach is problematic for a number of reasons:

  • Building a project simply to obtain the swiftc arguments is extremely inefficient. With regard to Periphery, the xcodebuild step accounts for over 95% of total runtime.
  • xcodebuild must also perform a 'clean' build, since th
protocol Injectable {
init()
}
class MyDependency {}
class MyClass: Injectable {
private let dep: MyDependency
required convenience init() {