agents/prompts/templates/swift.md
When adding or removing swift source code files, the build rules must be updated. The BUILD.gn file in the same folder or in a parent folder of the source file typically contains a build rule that includes a given source code file.
swift_source_set build rule
which defines a build target that contains only swift code.import("//build/config/apple/swift_source_set.gni") to be able to use the
swift_source_set rule.Use swift's direct C++ interop, if possible, whenever C++ code needs to be
invoked from swift. When needed, use the helpers in the C++ include file
base/apple/swift_interop_util.h to solve special cases.
swift_source_set rule that has a dependency on C++ code, use the
cxx_modulemap argument to specify a module map that imports the required C++
symbols.ios/chrome/test/swift_interop/BUILD.gn and the files referenced by its build
rules.ios/chrome/common/ui/colors/Color+Chrome.swift.if let uiImage = UIImage(named: "<image_resource_name>") {
Image(uiImage: uiImage)
}
NSLocalizedString.ios/chrome/app/strings/ios_strings.grd and
ios/chrome/app/resources/chrome_localize_strings_config.plistWhen you encounter non-trivial build errors related to swift/C++ interoperability, do not try to fix the problem yourself. Instead, annotate the the code with comments that explain what you understand about the problem, send a message to the user instructing them to fix the issue themselves, then quit.