Xcode 15.3 frameworks built now references SwiftUI

After updating our build server to Xcode 15.3, the frameworks (e.g. CCIeNewsNetworking) we build and release seems to reference SwiftUI.

Our deployment target is iOS11.

Customers have complained when running on iOS12:

dyld: Library not loaded: /System/Library/Frameworks/SwiftUI.framework/SwiftUI
  Referenced from: /private/var/containers/Bundle/Application/81538A25-464A-46E0-BC4D-6E1C002C82F0/Test.app/Frameworks/CCIeNewsNetworking.framework/CCIeNewsNetworking
  Reason: image not found

and I can see that "import SwiftUI" now appears in arm64-apple-ios.private.swiftinterface:

diff CCIeNewsNetworking.xcframework-7.3*/ios-arm64/CCIeNewsNetworking.framework/Modules/CCIeNewsNetworking.swiftmodule/arm64-apple-ios.private.swiftinterface
2,4c2,3
< // swift-compiler-version: Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)
< // swift-module-flags: -target arm64-apple-ios11.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -Onone -module-name CCIeNewsNetworking
< // swift-module-flags-ignorable: -enable-bare-slash-regex
---
> // swift-compiler-version: Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
> // swift-module-flags: -target arm64-apple-ios11.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -Onone -enable-bare-slash-regex -module-name CCIeNewsNetworking
7a7
> import DeveloperToolsSupport
9a10
> import SwiftUI
12a14
> import _SwiftConcurrencyShims
217c219
<   @objc public func removeOperation(issueIdentifer: Swift.String, fileName: Swift.String)
---
>   @objc public func removeOperation(issueIdentifier: Swift.String, fileName: Swift.String)

I don't recall having changed anything in the project settings, so where does "import SwiftUI" come from, and how can I avoid it ?

Answered by DTS Engineer in 785365022

If I were in your shoes I’d temporarily rip everything out of your framework target and see if the problems persists.

I tried replicating this here with a new framework containing just this code:

import Foundation

public struct Waffle {

    public init(finish: String) {
        self.finish = finish
    }
    
    public var finish: String
}

and the results were pretty much what I expected:

% cat "Test749860 15-04-2024"*".xcarchive/Products/Library/Frameworks/Test749860.framework/Modules/Test749860.swiftmodule/arm64-apple-ios.swiftinterface"
// swift-interface-format-version: 1.0
// …
// …
import Foundation
import Swift
@_exported import Test749860
import _Concurrency
import _StringProcessing
import _SwiftConcurrencyShims
public struct Waffle {
  public init(finish: Swift.String)
  public var finish: Swift.String
}

So clearly this doesn’t happen all the time, so there’s something in your code that’s triggering it. Remove all the code and then slowly add stuff back in until you see what’s triggering it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

If I were in your shoes I’d temporarily rip everything out of your framework target and see if the problems persists.

I tried replicating this here with a new framework containing just this code:

import Foundation

public struct Waffle {

    public init(finish: String) {
        self.finish = finish
    }
    
    public var finish: String
}

and the results were pretty much what I expected:

% cat "Test749860 15-04-2024"*".xcarchive/Products/Library/Frameworks/Test749860.framework/Modules/Test749860.swiftmodule/arm64-apple-ios.swiftinterface"
// swift-interface-format-version: 1.0
// …
// …
import Foundation
import Swift
@_exported import Test749860
import _Concurrency
import _StringProcessing
import _SwiftConcurrencyShims
public struct Waffle {
  public init(finish: Swift.String)
  public var finish: Swift.String
}

So clearly this doesn’t happen all the time, so there’s something in your code that’s triggering it. Remove all the code and then slowly add stuff back in until you see what’s triggering it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi Quinn, thank you for your great advice of ripping. I found out that an Images.xcassets triggered the "import SwiftUI".

Please try to add an image asset to your test framework and see if you also get the "import SwiftUI" now.

So, Apple effectively desupported iOS 12 with Xcode 15.3 ?

Deleting the image asset is not really an option, I could hack with grep/sed to delete the "import SwiftUI" line from arm64-apple-ios.private.swiftinterface, but would that affect iOS13+ ? Also it doesn't seem like a sustainable solution...

SOLVED: Just got the correct answer in a bug filed to Apple Feedback Assistant: This issue can be resolved by removing “SwiftUI” from the “Generate Swift Asset Symbol Framework Support” build setting

Xcode 15.3 frameworks built now references SwiftUI
 
 
Q