SKCodeCompletionSession
open class SKCodeCompletionSession : NSObject
Represents a SourceKit code completion session, which can be filtered using update requests.
-
Undocumented
Declaration
Swift
public typealias CompletionHandler = (SKCodeCompletionSession, Response) -> Void
-
Undocumented
Declaration
Swift
public typealias Options = SKCodeCompletionSessionOptions
-
Undocumented
Declaration
Swift
public typealias Response = SKCodeCompletionSessionResponse
-
The session source file.
Declaration
Swift
public let file: File
-
The byte offset of the code completion point inside the session’s source contents.
Declaration
Swift
public let offset: Offset
-
Whether previous requests should be canceled if a new request is made that uses different
options
.Note
The previous requests are not actually canceled (because they are asynchronous, and that ship has sailed); however, the completion handler will only be called with the response of the most recently sent request.Declaration
Swift
public var cancelOnSubsequentRequest: Bool
-
A closure that receives the code completion request responses.
Declaration
Swift
public var completionHandler: SKCodeCompletionSession.CompletionHandler?
-
A closure that receives any code completion request errors.
Declaration
Swift
public var errorHandler: SKCodeCompletionSession.ErrorHandler?
-
The most recent request response received in the session.
Declaration
Swift
public internal(set) var latestResponse: SKCodeCompletionSession.Response?
-
Whether there are any outstanding session requests awaiting completion.
Declaration
Swift
public var isActive: Bool { get }
-
The number of outstanding session requests awaiting completion.
Declaration
Swift
public var queueRequestCount: Int { get }
-
Initializes a new SourceKit code completion session object.
Note
This request needs to be opened (via the
open()
method).Declaration
Swift
public init(file: File, offset: Offset, compilerArguments: [String])
Parameters
file
The source file.
offset
The byte offset of the code completion point inside the source contents.
compilerArguments
The compiler arguments used to build the module.
-
Initializes a new SourceKit code completion session object.
Note
This request needs to be opened (via the
open()
method).Declaration
Swift
public convenience init(file: File, offset: Offset, sdkPath: String, target: String? = nil)
Parameters
file
The source file.
offset
The source code byte offset to use in the SourceKit request.
sdkPath
The path to the SDK to compile against.
target
The target (triple) architecture to generate completions for (e.g.
"arm64-apple-ios12.1"
). -
Initializes a new SourceKit code completion session object.
Note
This request needs to be opened (via the
open()
method).Declaration
Swift
public convenience init(filePath: String, offset: Offset, compilerArguments: [String])
Parameters
filePath
The file path of the source file.
offset
The byte offset of code completion point inside the source contents.
compilerArguments
The compiler arguments used to build the module.
-
Initializes a new SourceKit code completion session object.
Note
This request needs to be opened (via the
open()
method).Declaration
Swift
public convenience init(contents: String, offset: Offset, compilerArguments: [String])
Parameters
contents
The source code contents.
offset
The byte offset of code completion point inside the source contents.
compilerArguments
The compiler arguments used to build the module.
-
Initializes a new SourceKit code completion session object.
Note
This request needs to be opened (via the
open()
method).Declaration
Swift
public convenience init(filePath: String, offset: Offset, sdkPath: String, target: String? = nil)
Parameters
filePath
The file path of the source file.
offset
The byte offset of code completion point inside the source contents.
sdkPath
The path to the SDK to compile against.
target
The target (triple) architecture to generate completions for (e.g.
"arm64-apple-ios12.1"
). -
Initializes a new SourceKit code completion session object.
Note
This request needs to be opened (via the
open()
method).Declaration
Swift
public convenience init(contents: String, offset: Offset, sdkPath: String, target: String? = nil)
Parameters
contents
The source contents.
offset
The byte offset of code completion point inside the source contents.
sdkPath
The path to the SDK to compile against.
target
The target (triple) architecture to generate completions for (e.g.
"arm64-apple-ios12.1"
).
-
Updates an open code completion session with the specified
options
.Declaration
Swift
public func update()
-
Closes an opened code completion session.
Declaration
Swift
public func close()