Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Features

- Improve Objc/Swift experience with @HiddenFromObjc ([#62](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/62))

## 0.0.3

### Fixes
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
This project is an experimental SDK for Kotlin Multiplatform.
This SDK is a wrapper around different platforms such as JVM, Android, iOS, macOS, watchOS, tvOS that can be used on Kotlin Multiplatform.

[![Kotlin](https://img.shields.io/badge/Kotlin-1.8.0-blue.svg?style=flat&logo=kotlin)](https://kotlinlang.org)

| Packages | Maven Central
|-----------------------------------------| -------
| sentry-kotlin-multiplatform | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-kotlin-multiplatform/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-kotlin-multiplatform)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import io.sentry.kotlin.multiplatform.protocol.Breadcrumb
import io.sentry.kotlin.multiplatform.protocol.SentryId
import io.sentry.kotlin.multiplatform.protocol.User
import io.sentry.kotlin.multiplatform.protocol.UserFeedback
import kotlin.experimental.ExperimentalObjCRefinement
import kotlin.native.HiddenFromObjC

typealias ScopeCallback = (Scope) -> Unit
typealias OptionsConfiguration = (SentryOptions) -> Unit
Expand All @@ -19,6 +21,8 @@ object Sentry {
* @param context: The context (used for retrieving Android Context)
* @param configuration Options configuration handler.
*/
@OptIn(ExperimentalObjCRefinement::class)
@HiddenFromObjC
Comment on lines +24 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

M: Does this require a min. version of KMP that would not work in older versions?
If yes, maybe we can consider just adding a comment that this is not for Apple folks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The min. version for using our KMP sdk is 1.8.0 so nothing would change for current users, I should probably add a badge or something similar to our readme

fun init(context: Context, configuration: OptionsConfiguration) {
SentryBridge.init(context, configuration)
}
Expand Down
6 changes: 3 additions & 3 deletions sentry-samples/kmp-app/iosApp/iosApp/iOSApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import shared

@main
struct iOSApp: App {
let sentry = Sentry()

let sentry = Sentry.shared
Copy link
Contributor Author

@buenaflor buenaflor Mar 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Singletons mapped via Kotlin should be accessed via .shared: https://kotlinlang.org/docs/native-objc-interop.html#kotlin-singletons

init() {
// Initialize Sentry using shared code
AppSetupKt.initializeSentry()

// Shared scope across all platforms
AppSetupKt.configureSentryScope()

// Add platform specific scope in addition to the shared scope
sentry.configureScope { scope in
scope.setContext(key: "iOS Context", value: [
Expand Down