[Native] Add HiddenFromObjC and ShouldRefineInSwift annotations

This commit is contained in:
Rick Clephas
2022-08-19 16:44:05 +02:00
committed by SvyatoslavScherbina
parent a65cb947d6
commit 6ae517a2df
14 changed files with 399 additions and 3 deletions
@@ -6,6 +6,7 @@
package kotlin.native
import kotlin.experimental.ExperimentalObjCName
import kotlin.experimental.ExperimentalObjCRefinement
import kotlin.reflect.KClass
/**
@@ -100,3 +101,58 @@ public actual annotation class CName(actual val externName: String = "", actual
@MustBeDocumented
@ExperimentalObjCName
public actual annotation class ObjCName(actual val name: String = "", actual val swiftName: String = "", actual val exact: Boolean = false)
/**
* Meta-annotation that instructs the Kotlin compiler to remove the annotated function or property from the public Objective-C API.
*
* Annotation processors that refine the public Objective-C API can annotate their annotations with this meta-annotation
* to have the original declarations automatically removed from the public API.
*
* Note: only annotations with [AnnotationTarget.FUNCTION] and/or [AnnotationTarget.PROPERTY] are supported.
*/
@Target(AnnotationTarget.ANNOTATION_CLASS)
@Retention(AnnotationRetention.BINARY)
@MustBeDocumented
@ExperimentalObjCRefinement
public actual annotation class HidesFromObjC
/**
* Instructs the Kotlin compiler to remove this function or property from the public Objective-C API.
*/
@HidesFromObjC
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
@MustBeDocumented
@ExperimentalObjCRefinement
public actual annotation class HiddenFromObjC
/**
* Meta-annotation that instructs the Kotlin compiler to mark the annotated function or property as
* `swift_private` in the generated Objective-C API.
*
* Annotation processors that refine the public API in Swift can annotate their annotations with this meta-annotation
* to automatically hide the annotated declarations from Swift.
*
* See Apple's documentation of the [`NS_REFINED_FOR_SWIFT`](https://developer.apple.com/documentation/swift/objective-c_and_c_code_customization/improving_objective-c_api_declarations_for_swift)
* macro for more information on refining Objective-C declarations in Swift.
*
* Note: only annotations with [AnnotationTarget.FUNCTION] and/or [AnnotationTarget.PROPERTY] are supported.
*/
@Target(AnnotationTarget.ANNOTATION_CLASS)
@Retention(AnnotationRetention.BINARY)
@MustBeDocumented
@ExperimentalObjCRefinement
public actual annotation class RefinesInSwift
/**
* Instructs the Kotlin compiler to mark this function or property as `swift_private` in the generated Objective-C API.
*
* See Apple's documentation of the [`NS_REFINED_FOR_SWIFT`](https://developer.apple.com/documentation/swift/objective-c_and_c_code_customization/improving_objective-c_api_declarations_for_swift)
* macro for more information on refining Objective-C declarations in Swift.
*/
@RefinesInSwift
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
@MustBeDocumented
@ExperimentalObjCRefinement
public actual annotation class ShouldRefineInSwift