Skip to content

Conversation

@itaybre
Copy link
Contributor

@itaybre itaybre commented Jan 5, 2026

📜 Description

Converts SentryWatchdogTerminationIntegration to Swift

💡 Motivation and Context

Less ObjC code, more Swift type safety

💚 How did you test it?

📝 Checklist

You have to check all boxes before merging:

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

#skip-changelog

Migrate the Integration class from Objective-C to Swift, building on top of the
previously migrated Logic and Tracker Swift classes. The Swift Integration uses
a protocol-based dependency injection pattern for better testability.

Changes:
- Add SentryWatchdogTerminationTrackingIntegration.swift with generics
- Remove old Objective-C Integration implementation
- Update Integrations.swift to register the Swift integration
- Update SentrySDKInternal.m to remove ObjC registration
- Update Integration tests to work with new Swift implementation
Update the scope observer API to be more Swift-friendly. Rename addObserver to
addScopeObserver and make it accept Any type with runtime validation, allowing
Swift-defined protocols to work properly with Objective-C.

Changes:
- Rename addObserver: to addScopeObserver: in SentryScope
- Update addScopeObserver to accept Any with runtime protocol checking
- Remove addObserver from SentryScope+Private.h header
- Add addScopeObserver to SentryScope+PrivateSwift.h
- Update SentryCrashIntegration to use new API
- Update tests to cast observer to Any when needed
- Update Xcode project to include Integration Swift file
@itaybre itaybre force-pushed the ref/watchdog-integration-to-swift branch from b6b35bb to 7145675 Compare January 5, 2026 23:53
@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 89.06250% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.457%. Comparing base (ff7fa11) to head (7145675).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...SentryWatchdogTerminationTrackingIntegration.swift 88.524% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                            Coverage Diff                            @@
##           ref/watchdog-logic-tracker-to-swift     #7119       +/-   ##
=========================================================================
- Coverage                               84.739%   84.457%   -0.282%     
=========================================================================
  Files                                      459       454        -5     
  Lines                                    27515     27383      -132     
  Branches                                 12111     11986      -125     
=========================================================================
- Hits                                     23316     23127      -189     
- Misses                                    4157      4209       +52     
- Partials                                    42        47        +5     
Files with missing lines Coverage Δ
Sources/Sentry/SentryCrashIntegration.m 100.000% <100.000%> (ø)
Sources/Sentry/SentrySDKInternal.m 83.682% <ø> (-0.902%) ⬇️
Sources/Sentry/SentryScope.m 96.065% <100.000%> (+0.012%) ⬆️
Sources/Swift/SentryDependencyContainer.swift 98.275% <ø> (ø)
...SentryWatchdogTerminationTrackingIntegration.swift 88.524% <88.524%> (ø)

... and 50 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff7fa11...7145675. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants