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

Add extension field to Kotlin sealed class for conversion to Swift enum #82

Open
Pschsch opened this issue Jun 27, 2023 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@Pschsch
Copy link

Pschsch commented Jun 27, 2023

Now we need directly use initializer of *Ks types to instantiate it. Their names could be so big, so to improve readability we could use this sort of construction to decrease usage of long type names. Example:
Now:

class VeryBigNameOfViewModel {
   sealed class State {
       data class Success(val data : String, val someOtherData : Int) : State()
       object Loading : State()
   }
}

class Controller : UIViewController {
  ...
  private func observeState(_ state : VeryBigNameOfViewModel.State) {
      switch VeryBigNameOfViewModelStateKs(state) /*not pretty*/ { ...
  }
}

Wish:

class Controller : UIViewController {
  ...
  private func observeState(_ state : VeryBigNameOfViewModel.State) {
      switch state.ksEnum /*for example*/ { ...
  }
}

Seems that it's not so hard)

@Alex009 Alex009 added the enhancement New feature or request label Jun 28, 2023
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

No branches or pull requests

2 participants