Skip to content

Xcode Compatibility Enhancement: @retroactive Attribute Implementation #105

@yemretekin

Description

@yemretekin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions