Library not loaded: /System/Library/Frameworks/SwiftUICore.framework/SwiftUICore

Hello.

I'm building an iOS application that builds a framework named Design.framework using Xcode 16.1. When I launch my application on iOS 17.X, i get the following runtime error

dyld[47899]: Library not loaded: /System/Library/Frameworks/SwiftUICore.framework/SwiftUICore
  Referenced from: <E625A246-E36B-351A-B077-CC38BAB5E07B> /Users/v/Library/Developer/Xcode/DerivedData/iScribd-bexojbdreldwkvbpzioqueldnvng/Build/Products/Debug_AppStore-iphonesimulator/Design.framework/Design
  Reason: tried: '/Users/v/Library/Developer/Xcode/DerivedData/iScribd-bexojbdreldwkvbpzioqueldnvng/Build/Products/Debug_AppStore-watchsimulator/SwiftUICore.framework/SwiftUICore' (no such file), '/Users/v/Library/Developer/Xcode/DerivedData/iScribd-bexojbdreldwkvbpzioqueldnvng/Build/Products/Debug_AppStore-iphonesimulator/SwiftUICore.framework/SwiftUICore' (no such file), '/Users/v/Library/Developer/Xcode/DerivedData/iScribd-bexojbdreldwkvbpzioqueldnvng/Build/Products/Debug_AppStore-watchsimulator/PackageFrameworks/SwiftUICore.framework/SwiftUICore' (no such file), '/Users/v/Library/Developer/Xcode/DerivedData/iScribd-bexojbdreldwkvbpzioqueldnvng/Build/Products/Debug_AppStore-iphonesimulator/PackageFrameworks/SwiftUICore.framework/SwiftUICore' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore' (no such file), '/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore' (no such file, not in dyld cache), '/Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore' (no such file)

This error does not happen on iOS 18+. When i run dyld_info Design.framework/Design, i see that there is indeed a dependency on SwiftUICore.framework

Design.framework/Design [arm64]:
    -platform:
        platform     minOS      sdk
   iOS-simulator     16.0      18.1
    -uuid:
        09880F25-DC86-3D8E-BCAE-1A283508D879
    -segments:
        load-offset   segment  section       sect-size  seg-size max-prot init-prot
        0x00000000    __TEXT                               416KB r.x
        0x00000000    __TEXT                               416KB r.x
        0x0000543C             __text           355508
        0x0005C0F0             __stubs            3168
        0x0005CD50             __objc_methlist      32
        0x0005CD70             __const            8296
        0x0005EDD8             __swift5_typeref  15820
        0x00062BB0             __cstring          6885
        0x00064698             __constg_swiftt    2804
        0x0006518C             __swift5_builtin     40
        0x000651C0             __swift5_reflstr   2952
        0x00065D48             __swift5_assocty    816
        0x00066078             __objc_methname     299
        0x000661A4             __swift5_proto      368
        0x00066314             __swift5_types      280
        0x0006642C             __swift5_fieldmd   3688
        0x00067294             __swift5_protos       8
        0x0006729C             __swift5_capture    244
        0x00067390             __unwind_info      2296
        0x00067C88             __eh_frame          888
        0x00068000    __DATA_CONST                          16KB rw.
        0x00068000    __DATA_CONST                          16KB rw.
        0x00068000             __got              3704
        0x00068E78             __const            6864
        0x0006A948             __objc_classlist     40
        0x0006A970             __objc_imageinfo      8
        0x0006C000    __DATA                                32KB rw.
        0x0006C000    __DATA                                32KB rw.
        0x0006C000             __objc_const        792
        0x0006C318             __objc_selrefs       96
        0x0006C378             __objc_classrefs     48
        0x0006C3A8             __objc_data         208
        0x0006C478             __data             4136
        0x0006D4A0             __bss             12784
        0x00070690             __common           4592
    -linked_dylibs:
        attributes     load path
                       @rpath/CommonTools.framework/CommonTools
                       /System/Library/Frameworks/Foundation.framework/Foundation
                       /usr/lib/libobjc.A.dylib
                       /usr/lib/libSystem.B.dylib
                       /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
                       /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
                       /System/Library/Frameworks/CoreText.framework/CoreText
        weak-link      /System/Library/Frameworks/DeveloperToolsSupport.framework/DeveloperToolsSupport
                       /System/Library/Frameworks/SwiftUI.framework/SwiftUI
                       /System/Library/Frameworks/SwiftUICore.framework/SwiftUICore
                       /System/Library/Frameworks/UIKit.framework/UIKit
                       /usr/lib/swift/libswiftCore.dylib
        weak-link      /usr/lib/swift/libswiftCoreAudio.dylib
                       /usr/lib/swift/libswiftCoreFoundation.dylib
        weak-link      /usr/lib/swift/libswiftCoreImage.dylib
        weak-link      /usr/lib/swift/libswiftCoreMedia.dylib
        weak-link      /usr/lib/swift/libswiftDarwin.dylib
        weak-link      /usr/lib/swift/libswiftDataDetection.dylib
        weak-link      /usr/lib/swift/libswiftDispatch.dylib
        weak-link      /usr/lib/swift/libswiftFileProvider.dylib
        weak-link      /usr/lib/swift/libswiftMetal.dylib
        weak-link      /usr/lib/swift/libswiftOSLog.dylib
                       /usr/lib/swift/libswiftObjectiveC.dylib
        weak-link      /usr/lib/swift/libswiftQuartzCore.dylib
        weak-link      /usr/lib/swift/libswiftSpatial.dylib
        weak-link      /usr/lib/swift/libswiftUniformTypeIdentifiers.dylib
        weak-link      /usr/lib/swift/libswiftXPC.dylib
                       /usr/lib/swift/libswift_Concurrency.dylib
        weak-link      /usr/lib/swift/libswiftos.dylib
        weak-link      /usr/lib/swift/libswiftsimd.dylib
        weak-link      /usr/lib/swift/libswiftUIKit.dylib

I can add a -weak_framework SwiftUICore to "Other Linker Flags" in my Design.framework Build Settings, and that will solve my problem, but I'd like to know what prompts my Design.framework to depend on SwiftUICore despite having a minimum set to iOS 16? And how am I supposed to handle devices prior to iOS 18 which do not have this library? is adding the linker flag the right way forward?

Here's another recent thread — is the Xcode project for your Design framework created by Xcode, or are other tools creating or manipulating the Xcode project file?

You shouldn't need to apply any workaround or linker flags here — a properly configured Xcode project should handle this transparently to you.

— Ed Ford,  DTS Engineer

Hi, thanks for your help. The project was indeed created by Xcode, however, it was created with Xcode 15.3 and is now being compiled by Xcode 16.1. The only tool we use to change our code is SwiftLint, but im not seeing any code changes when the build is run.

I followed the thread you pointed to. We are also using TCA v1.17 in our main application, however, our Design.framework doesn't have a dependency on it.

I will add that we found something unusual. We added a new SwiftUI view that operates as a container with multiple types for its children. When we removed this view, the issue went away.

struct MyView<Child1: View, Child2: View>: View {
    private let child1: () -> Child1
    private let child2: () -> Child2

    init(
        @ViewBuilder child1: @escaping () -> Child1,
        @ViewBuilder child2: @escaping () -> Child2
    ) {
        self.child1 = child1
        self.child2 = child2
    }

    var body: some View {
        VStack {
              child1()
              child2()
        }
    }
}

Our assumption is, this code causes SwiftUI.framework to pull SwiftUICore.framework as a strongly linked dependency.

I sincerely appreciate your help!

That's an interesting finding you made there. Would you mind running a test with that code?

  1. Create a brand new Xcode project
  2. Modify it's deployment target to reflect your real app's deployment target
  3. Bring MyView into this test app
  4. Add a small bit of code to use MyView in some way similar to how its used in your real app
  5. Test it the same way you are your real app to see if it crashes

If that crashes, this test project will be very helpful for us to investigate as a bug report. If it reproduces, attach this project, along with the crash report to the bug number, and post the FB number here for my reference.

—Ed Ford,  DTS Engineer

I had the same problem: Library not loaded: /System/Library/Frameworks/SwiftUICore.framework/SwiftUICore

This was caused because of a name in the all that make the Linker confused. the app

My proyecto name was APP and it was the problem... after changing it to something different and changing the Scheeme and some other places related to the project name change, the problem was done.

I am also having this problem with my app, which is also named App in the project. Is this really the cause of the problem? If I just rename it then it will work on ios17 as well as ios18? Seems very odd...

Library not loaded: /System/Library/Frameworks/SwiftUICore.framework/SwiftUICore
 
 
Q