I create a swift file (test.swift):
import UIKit
func test() {
let view = UIView()
print(view)
}
Then run the command swiftc test.swift in terminal. It outputs
error: no such module 'UIKit'
How to import the 'UIKit' module?
I create a swift file (test.swift):
import UIKit
func test() {
let view = UIView()
print(view)
}
Then run the command swiftc test.swift in terminal. It outputs
error: no such module 'UIKit'
How to import the 'UIKit' module?
You need to link sdk and specify what target you building for:
swiftc input.swift
-o output.o
-sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk
-target arm64-apple-ios12.0