diff --git a/CHANGELOG.md b/CHANGELOG.md index 09733f266e0..a017f40b60e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Cache installationID async to avoid file IO on the main thread when starting the SDK (#3601) - Add reason for NSPrivacyAccessedAPICategoryFileTimestamp (#3626) +- Exposes `tags` property of `SentryScope` (#3650) ### Fixes diff --git a/Sources/Sentry/Public/SentryScope.h b/Sources/Sentry/Public/SentryScope.h index 70d6ec6ae78..4b6f354e3a7 100644 --- a/Sources/Sentry/Public/SentryScope.h +++ b/Sources/Sentry/Public/SentryScope.h @@ -21,6 +21,11 @@ NS_SWIFT_NAME(Scope) */ @property (nullable, nonatomic, strong) id span; +/** + * Gets the dictionary of currently set tags. + */ +@property (nonatomic, readonly, copy) NSDictionary *tags; + - (instancetype)initWithMaxBreadcrumbs:(NSInteger)maxBreadcrumbs NS_DESIGNATED_INITIALIZER; - (instancetype)init; - (instancetype)initWithScope:(SentryScope *)scope; @@ -47,11 +52,6 @@ NS_SWIFT_NAME(Scope) */ - (void)setTags:(NSDictionary *_Nullable)tags; -/** - * Gets the dictionary of currently set tags. - */ -- (NSDictionary *)tags; - /** * Set global extra -> these will be sent with every event */ diff --git a/Tests/SentryTests/SentryScopeSwiftTests.swift b/Tests/SentryTests/SentryScopeSwiftTests.swift index 0f3984560a1..3df1c35cadc 100644 --- a/Tests/SentryTests/SentryScopeSwiftTests.swift +++ b/Tests/SentryTests/SentryScopeSwiftTests.swift @@ -457,33 +457,27 @@ class SentryScopeSwiftTests: XCTestCase { func testScopeObserver_setTags() { let sut = Scope() - let observer = fixture.observer - sut.add(observer) sut.setTags(fixture.tags) - XCTAssertEqual(fixture.tags, observer.tags) + XCTAssertEqual(fixture.tags, sut.tags) } func testScopeObserver_setTagValue() { let sut = Scope() - let observer = fixture.observer - sut.add(observer) sut.setTag(value: "tag", key: "tag") - XCTAssertEqual( ["tag": "tag"], observer.tags) + XCTAssertEqual( ["tag": "tag"], sut.tags) } func testScopeObserver_removeTag() { let sut = Scope() - let observer = fixture.observer - sut.add(observer) sut.setTag(value: "tag", key: "tag") sut.removeTag(key: "tag") - XCTAssertEqual(0, observer.tags?.count) + XCTAssertEqual(0, sut.tags.count) } func testScopeObserver_setExtras() {