Xcode 14+ creates arm64-apple-ios.abi.json by default

I have noticed that starting from Xcode 14 when I build my XCFramework it contains arm64-apple-ios.abi.json files. This file contains values of private/internal properties of the classes from the framework. For example:
"filePath": "/Users/jakub/Framework/Test.swift",
"kind": "StringLiteral",
"offset": 2041,
"length": 38,
"value": ""506D5F19-6B44-43A4-M15F-4462A9100899""

Is this behaviour intended? Now anybody can read private values from the framework from this json file. I would expect that at least this will be opt-in feature of Xcode. After little bit of searching I have found that this can be turned off by OTHER_SWIFT_FLAGS = "-Xfrontend -empty-abi-descriptor"; in the Build Settings. Another thing is that there is very little documentation about this feature. I think this can be a big surprise for some SDK developers that suddenly XCode reveals their private values in the arm64-apple-ios.abi.json file.

I have also noticed that this file is created only if BUILD_LIBRARY_FOR_DISTRIBUTION is set to YES in Build Settings. I have tried building my XCFramework with Xcode 14.1, removing arm64-apple-ios.abi.json and then use it in my app in Xcode 14.3 and it worked fine. So I am not sure if this file is required to support Library evolution or not.

1 Like

Hey @jakub-vallo , This abi.json file isn't required for supporting library evolution at all. The most common usage for this file is to serve as an input for ABI stability checking purposes using the swift-api-digester tool (swift/swift_api_digester_main.cpp at main · apple/swift · GitHub), where two JSON files are specified for comparison. You've made a great point that whether we should turn this output file into an opt-in output instead of always emitting it when BUILD_LIBRARY_FOR_DISTRIBUTION is specified though. Could you file an GitHub issue for this?

1 Like

Hi @Xi_Ge, thank you for your reply. I can file an GitHub issue. Can you please provide the link/repo where should I do it? Thanks.

Hi @jakub-vallo @Xi_Ge Was the issue raised on github ?. Would like to see if there is a solution or if we can opt out so private values are not exposed.

Is it ok to add OTHER_SWIFT_FLAGS = "-Xfrontend -empty-abi-descriptor"; in the Build Settings as a workaround for this problem?

created the issue here : Xcode 14+ creates arm64-apple-ios.abi.json by default · Issue #69576 · apple/swift · GitHub

@deepesh-vasthimal-ck We are using OTHER_SWIFT_FLAGS = "-Xfrontend -empty-abi-descriptor" as a workaround and it works fine.

Thanks @jakub-vallo What about the impact on ABI stability as @Xi_Ge mentioned this file may have an impact on ABI stability.