How do I debug the compiler when the file needs to import a framework like SwiftUI?

Hi all,

When running this

-dump-ast /Users/vuk/Desktop/main.swift

My main.swift file has an import SwiftUI and I am getting an error "no such module 'SwiftUI'.

Do I need to pass in any special arguments when debugging something that depends on SwiftUI or any other framework?

Thanks!

SwiftUI is part of the SDK, but the compiler doesn't know about the SDK unless explicitly told about it.

xcrun -sdk macosx swiftc -dump-ast /Users/vuk/Desktop/main.swift

You can see the list of potential -sdk arguments with xcodebuild -showsdks.

3 Likes
Terms of Service

Privacy Policy

Cookie Policy