Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve Objc/Swift experience with HiddenFromObjc #62

Merged
merged 6 commits into from
Mar 29, 2023

Conversation

buenaflor
Copy link
Contributor

@buenaflor buenaflor commented Mar 29, 2023

Add @HiddenFromObjc annotation to hide init with context from Cocoa targets.
This is very useful if we want to have certain things hidden to make the Swift experience better in general

https://kotlinlang.org/docs/native-objc-interop.html

@@ -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

@buenaflor buenaflor requested a review from marandaneto March 29, 2023 13:21
Comment on lines +24 to +25
@OptIn(ExperimentalObjCRefinement::class)
@HiddenFromObjC
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

@buenaflor buenaflor merged commit 5959b49 into main Mar 29, 2023
@buenaflor buenaflor deleted the feat/cocoa-api-interop branch March 29, 2023 14:48
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