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

Generated Enum Doesn't Use Value in @ObjCName #128

Open
mrf7 opened this issue Dec 11, 2024 · 2 comments
Open

Generated Enum Doesn't Use Value in @ObjCName #128

mrf7 opened this issue Dec 11, 2024 · 2 comments

Comments

@mrf7
Copy link

mrf7 commented Dec 11, 2024

When adding the ObjCName to a type within a sealed class, the name of the generated enum case uses the Kotlin class name rather than the name given fo objective c.

// Kotlin 
sealed class MyClass {
    @OptIn(ExperimentalObjCName::class)
    @ObjCName("clasInSwift")
    object ClassCaseA : MyClass()
    data class ClassCaseB(val s: String) : MyClass()
}

// Generated swift enum 
@frozen
public enum __Sealed : Swift.Hashable {
case classCaseA(CMPTAutomationIdentifiers.MyClass.classInSwift) // generated case doesnt use objcname
case classCaseB(CMPTAutomationIdentifiers.MyClass.ClassCaseB)
}
@TadeasKriz
Copy link
Collaborator

Hey @mrf7, I believe we couldn't use it because the "objc name" contains all the outer class' names too.

However, if you'd like to rename just the enum case, you can use @SealedInterop.Case.Name("CustomName2") (https://skie.touchlab.co/configuration/sealed#name-string-1)

@mrf7
Copy link
Author

mrf7 commented Dec 11, 2024

Ah I missed that in the docs, thanks Tadeas you're the best!

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

No branches or pull requests

2 participants