Converts SentrySamplerDecision from Objective-C to Swift as part of the ongoing Swift migration effort. This type had no internal ObjC dependencies (leaf node in the dependency graph), making it a clean candidate for conversion.
The Swift class is public @objcMembers so it appears in the generated -Swift.h header for consumption by ObjC .m files. Since ObjC++ (.mm) files cannot import the generated Swift header, a small C helper (sentry_samplerDecisionEquals) is provided in SentrySamplerDecisionHelper to bridge that gap.
Changes:
- Removed
SentrySamplerDecision.h / .m
- Added
SentrySamplerDecision.swift in Sources/Swift/Core/
- Added
SentrySamplerDecisionHelper.h / .m with extern "C" linkage for ObjC++ compatibility
- Removed stale
#import "SentrySamplerDecision.h" from 7 files
- Updated
SentryProfiledTracerConcurrency.mm to use the helper function
- Updated
project.pbxproj accordingly
#skip-changelog
Note
The pull request "ref: convert SentrySamplerDecision from ObjC to Swift" was created by @philprime but did not reference an issue. Therefore this issue was created for better visibility in external tools like Linear.
Converts
SentrySamplerDecisionfrom Objective-C to Swift as part of the ongoing Swift migration effort. This type had no internal ObjC dependencies (leaf node in the dependency graph), making it a clean candidate for conversion.The Swift class is
public @objcMembersso it appears in the generated-Swift.hheader for consumption by ObjC.mfiles. Since ObjC++ (.mm) files cannot import the generated Swift header, a small C helper (sentry_samplerDecisionEquals) is provided inSentrySamplerDecisionHelperto bridge that gap.Changes:
SentrySamplerDecision.h/.mSentrySamplerDecision.swiftinSources/Swift/Core/SentrySamplerDecisionHelper.h/.mwithextern "C"linkage for ObjC++ compatibility#import "SentrySamplerDecision.h"from 7 filesSentryProfiledTracerConcurrency.mmto use the helper functionproject.pbxprojaccordingly#skip-changelog