@@ -158,6 +158,31 @@ workflows:
158158 -archive "Archives/P256K-watchOS.xcarchive" -framework P256K.framework \
159159 -archive "Archives/P256K-watchOS Simulator.xcarchive" -framework P256K.framework \
160160 -output P256K.xcframework
161+
162+ # Workaround for Swift issue SR-14195/GitHub #56573:
163+ # When a module has the same name as a type it contains (P256K in this case),
164+ # Swift generates invalid module interfaces with incorrect type qualifications.
165+ # This leads to imports failing with errors like:
166+ # "TypeName is not a member type of class ModuleName.ModuleName"
167+ #
168+ # This script fixes generated .swiftinterface files by:
169+ # 1. Removing double-qualification of the P256K type
170+ # 2. Fixing references to other types that don't need module qualification
171+ # See: https://github.com/swiftlang/swift/issues/56573
172+ find P256K.xcframework -name '*.swiftinterface' -print0 \
173+ | xargs -0 sed -i '' \
174+ -e 's/extension P256K\.P256K/extension P256K/g' \
175+ -e 's/P256K\.P256K\./P256K\./g' \
176+ -e 's/[[:<:]]P256K\.secp256k1Error[[:>:]]/secp256k1Error/g' \
177+ -e 's/[[:<:]]P256K\.Digest[[:>:]]/Digest/g' \
178+ -e 's/[[:<:]]P256K\.CryptoKitError[[:>:]]/CryptoKitError/g' \
179+ -e 's/[[:<:]]P256K\.CryptoKitASN1Error[[:>:]]/CryptoKitASN1Error/g' \
180+ -e 's/[[:<:]]P256K\.SHA256Digest[[:>:]]/SHA256Digest/g' \
181+ -e 's/[[:<:]]P256K\.XonlyKeyImplementation[[:>:]]/XonlyKeyImplementation/g' \
182+ -e 's/[[:<:]]P256K\.HashDigest[[:>:]]/HashDigest/g' \
183+ -e 's/[[:<:]]P256K\.SharedSecret[[:>:]]/SharedSecret/g' \
184+ -e 's/[[:<:]]P256K\.PublicKeyImplementation[[:>:]]/PublicKeyImplementation/g' \
185+ -e 's/[[:<:]]P256K\.PrivateKeyImplementation[[:>:]]/PrivateKeyImplementation/g'
161186 - deploy-to-bitrise-io :
162187 inputs :
163188 - deploy_path : " $BITRISE_SOURCE_DIR/P256K.xcframework"
0 commit comments