scanbot-sdk-example-ios icon indicating copy to clipboard operation
scanbot-sdk-example-ios copied to clipboard

Xcode Compatibility Enhancement: @retroactive Attribute Implementation

Open yemretekin opened this issue 9 months ago • 1 comments
trafficstars

Xcode Compatibility Enhancement: @retroactive Attribute Implementation

Description

While working with the SwiftUIComponentsExample project, I noticed that builds on Xcode 15.4 and 15.1 encounter an issue with the @retroactive attribute. I'd like to share my findings and suggest a potential solution that might help other developers.

Current Behavior

  • ❌ Xcode 15.1: Build fails due to unrecognized @retroactive attribute
  • ❌ Xcode 15.4: Same behavior as 15.1
  • ✅ Xcode 16.0: Works as expected

Technical Details

The compiler doesn't recognize the @retroactive attribute when implementing Identifiable conformance for SBSDKScannedPage in Xcode versions prior to 16.0.

Suggested Solution

I found that implementing a conditional compilation block resolves this issue while maintaining compatibility across Xcode versions

#if hasFeature(RetroactiveAttribute)
extension SBSDKScannedPage: @retroactive Identifiable { }
#else
extension SBSDKScannedPage: Identifiable { }
#endif

Benefits

This enhancement would help developers who are using various Xcode versions to work with the SDK more smoothly, especially those who haven't upgraded to Xcode 16.0 yet.

I hope this suggestion is helpful. Please let me know if you need any additional information or clarification.

yemretekin avatar Feb 22 '25 11:02 yemretekin

Hello @yemretekin, thank you very much for your detailed feedback. Much appreciated! Our next SDK release will fix this issue as you suggested.

sebastato avatar Feb 25 '25 14:02 sebastato