ImporterContext
Swift
public final class ImporterContext: Sendable
Context for resolving an import / use / forward rule.
Topics
var fromImport: Bool
var fromImport: Bool
Whether this request comes from an @import rule.
See import-only files.
Declaration
Swift
public let fromImport: Bool
var containingURL: URL?
var containingURL: URL?
The canonical URL of the source file that contains the load being resolved.
Set when the source file has a URL and the import request’sruleURL is either relative or, in
the case of Importers, has a scheme returned by Importer.noncanonicalURLSchemes.
Access this only if strictly necessary: the compiler does not cache canonical URLs that use it: the idea is that import resolution should ideally be context-free.
Declaration
Swift
public var containingURL: URL? { get }