Skip to content

Commit

Permalink
feat: improve Objc/Swift experience with HiddenFromObjc (#62)
Browse files Browse the repository at this point in the history
* add HiddenFromObjc

* Update changelog

* add kotlin badge
  • Loading branch information
buenaflor authored Mar 29, 2023
1 parent aeb45f2 commit 5959b49
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
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
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
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

0 comments on commit 5959b49

Please sign in to comment.