How to automatically import SwiftUI when importing a Swift Package?

Viewed 38

Context

I created a custom SwiftUI Package which heavily relies on SwiftUI. When using this Package in my project, I always have to import SwiftUI and MyCustomPackage separately. However, when importing UIKit or SwiftUI, the Foundation Framework gets imported Automatically. I would like to mimic this behaviour with my own Package.


Code

import SwiftUI // Automatically imports Foundation

---

import SwiftUI
import MyCustomPackage // I have to manually import SwiftUI next to MyCustomPackage

Question

  • How can I achieve my goal to bundle SwiftUI with MyCustomPackage, so that I only have to explicitly import MyCustomPackage?
0 Answers
Related