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: Add a delegate to read and mutate an apiEnum backingfield seamlessly #301

Merged
merged 1 commit into from
Feb 27, 2025

Conversation

LunarX
Copy link
Collaborator

@LunarX LunarX commented Feb 27, 2025

Up till now, I only needed to read from an ApiEnum backing field so calling apiEnumValueOfOrNull everywhere was enough. But now I will also need to mutate this field so, to make it easier to manipulate I created this delegate that can be used as such:

class Example {
    private var _snoozeState: String? = null
    var snoozeState: SnoozeState? by apiEnum(::_snoozeState)
}

@LunarX LunarX added the enhancement New feature or request label Feb 27, 2025
@LunarX LunarX requested a review from tevincent February 27, 2025 12:29
@LunarX LunarX self-assigned this Feb 27, 2025
@LunarX LunarX merged commit aa190d6 into main Feb 27, 2025
7 checks passed
@LunarX LunarX deleted the api-enum-delegate branch February 27, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants