Skip to content

Conversation

@philprime
Copy link
Member

📜 Description

Convert SentryAutoBreadcrumbTrackingIntegration from Objective-C to Swift following the SwiftIntegration protocol pattern. Updated the conversion guide with learnings including:

  • Exposing Objective-C headers via SentryPrivate.h
  • Runtime initialization pattern for conditionally compiled classes
  • Typealias dependency injection pattern
  • Test fixture setup with dependency injection

💡 Motivation and Context

Closes #6860

💚 How did you test it?

  • Unit tests

#skip-changelog

Convert SentryAutoBreadcrumbTrackingIntegration from Objective-C to
Swift following the SwiftIntegration protocol pattern. Updated the
conversion guide with learnings including:

- Exposing Objective-C headers via SentryPrivate.h
- Runtime initialization pattern for conditionally compiled classes
- Typealias dependency injection pattern
- Test fixture setup with dependency injection
@philprime philprime self-assigned this Jan 12, 2026
@philprime philprime added the ready-to-merge Use this label to trigger all PR workflows label Jan 12, 2026
@philprime
Copy link
Member Author

@sentry review

@github-actions
Copy link
Contributor

github-actions bot commented Jan 12, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@codecov
Copy link

codecov bot commented Jan 12, 2026

❌ 7 Tests Failed:

Tests completed Failed Passed Skipped
4438 7 4431 22
View the top 3 failed test(s) by shortest run time
SentryCrashBinaryImageCacheTests::testSentryBinaryImageCacheIntegration
Stack Traces | 0s run time
.../SentryTests/SentryCrash/SentryCrashBinaryImageCacheTests.m:291 - ((5) equal to (imageCache.cache.count)) failed: ("5") is not equal to ("6")
SentryTests.SentrySystemEventBreadcrumbsTest::testBatteryBreadcrumbForSessionReplay
Stack Traces | 0s run time
.../Integrations/Breadcrumbs/SentrySystemEventBreadcrumbsTest.swift:174 - XCTAssertEqual failed: ("nil") is not equal to ("Optional(100.0)")
SentryTests.SentrySystemEventBreadcrumbsTest::testStopCallsSpecificRemoveObserverMethods
Stack Traces | 0s run time
.../Integrations/Breadcrumbs/SentrySystemEventBreadcrumbsTest.swift:376 - XCTAssertEqual failed: ("8") is not equal to ("7")
SentryTests.SentrySystemEventBreadcrumbsTest::testTimezoneChangeInitialBreadcrumb
Stack Traces | 0s run time
.../Integrations/Breadcrumbs/SentrySystemEventBreadcrumbsTest.swift:315 - XCTAssertEqual failed: ("nil") is not equal to ("Optional(7200)")
SentryTests.SentrySystemEventBreadcrumbsTest::testTimezoneChangeNotificationBreadcrumb
Stack Traces | 0s run time
.../Integrations/Breadcrumbs/SentrySystemEventBreadcrumbsTest.swift:328 - XCTAssertEqual failed: ("nil") is not equal to ("Optional(7200)")
SentryTests.SentrySystemEventBreadcrumbsTest::testTimezoneChangeNotificationBreadcrumb_NoStoredTimezoneOffset
Stack Traces | 0s run time
.../Integrations/Breadcrumbs/SentrySystemEventBreadcrumbsTest.swift:342 - XCTAssertEqual failed: ("nil") is not equal to ("Optional(7200)")
iOS_Swift_UITests.LaunchUITests::testBreadcrumbData
Stack Traces | 0s run time
.../iOS-Swift/iOS-Swift-UITests/LaunchUITests.swift:10 - XCTAssertEqual failed: ("{ category: device.connectivity, parentViewController: nil, beingPresented: nil, window_isKeyWindow: nil, is_window_rootViewController: nil }") is not equal to ("{ category: ui.lifecycle, parentViewController: UITabBarController, beingPresented: false, window_isKeyWindow: true, is_window_rootViewController: false }")
iOS_Swift_UITests.UIEventBreadcrumbTests::testNoBreadcrumbForTextFieldEditingChanged
Stack Traces | 0s run time
.../iOS-Swift/iOS-Swift-UITests/UITestHelpers.swift:5 - XCTAssertTrue failed - performEditingChangedPressed: not called

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

…yAutoBreadcrumbTrackingIntegration

This update adds the @objc annotation to the addBreadcrumb method, allowing it to be accessible from Objective-C code. Additionally, the import statement in the test file has been adjusted for consistency with Swift's SPI usage.
@github-actions
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1224.00 ms 1260.90 ms 36.90 ms
Size 24.14 KiB 1.07 MiB 1.05 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
1357911 1222.84 ms 1258.38 ms 35.54 ms
37bc095 1210.00 ms 1242.69 ms 32.69 ms
50e7b3e 1221.54 ms 1250.81 ms 29.27 ms
2b4e787 1226.06 ms 1258.65 ms 32.59 ms
e1e5f3b 1220.60 ms 1241.63 ms 21.04 ms
79e2bb8 1216.37 ms 1242.42 ms 26.05 ms
013fd4d 1216.02 ms 1242.16 ms 26.14 ms
3b01aaf 1194.98 ms 1210.36 ms 15.38 ms
2c4362a 1231.50 ms 1255.95 ms 24.45 ms
5d67f5d 1225.33 ms 1262.76 ms 37.43 ms

App size

Revision Plain With Sentry Diff
1357911 24.14 KiB 1.07 MiB 1.04 MiB
37bc095 24.14 KiB 1.06 MiB 1.04 MiB
50e7b3e 24.14 KiB 1.04 MiB 1.02 MiB
2b4e787 24.14 KiB 1.07 MiB 1.04 MiB
e1e5f3b 24.14 KiB 1.06 MiB 1.04 MiB
79e2bb8 24.14 KiB 1.04 MiB 1.02 MiB
013fd4d 24.14 KiB 1.04 MiB 1.02 MiB
3b01aaf 24.14 KiB 1.06 MiB 1.04 MiB
2c4362a 24.14 KiB 1.07 MiB 1.04 MiB
5d67f5d 24.14 KiB 1.06 MiB 1.04 MiB

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

Labels

ready-to-merge Use this label to trigger all PR workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor SentryAutoBreadcrumbTrackingIntegration.m in Swift

2 participants