I’ve an iOS SwiftUI app with three targets – an app goal and a couple of static libraries (as proven under)
Challenge Workspace
--AppTarget
----(some information)
--EntryPoint (static library)
---- <Struct conforming to App protocol>.swift
---- AppDelegate.swift
---- (different information)
--Expertise (static library)
---- ContentView.swift
---- (different information)
For some causes, the hierarchy is outlined as follows:
// AppTarget is determined by EntryPoint and Expertise
AppTarget -> EntryPoint, Expertise
// Expertise is determined by EntryPoint
Expertise -> EntryPoint
EntryPoint library has the entry level of the app i.e., a struct conforming to the App protocol. The physique property should be a Scene, which should comprise a View. The issue is, View is outlined in Expertise… and since Expertise is determined by EntryPoint, I can not mark Expertise as a dependency for EntryPoint and do the next
import Expertise
within the EntryPoint goal as that might trigger cyclic dependency error.
SwiftUI expects the Views contained in the Scene to be recognized at compile time.
Questions:
- How can I make the next code compile?
@most important
public struct ProjectApp: App {
@UIApplicationDelegateAdaptor
non-public var appDelegate: AppDelegate
public var physique: some Scene {
WindowGroup {
ContentView() // ERROR
}
}
public init() {
}
}
ContentView is outlined in Expertise however I can not import Expertise as it’s a increased library. From what I gathered, there are not any externs or ahead declarations in Swift.
- The Expertise library has some stuff to do within the utility(_:didFinishLaunchingWithOptions:) launch delegate technique. The AppDelegate is outlined within the EntryPoint. How can I even invoke a technique of a better library (Expertise) from a decrease library (EntryPoint) in Swift?