Skip to content

Conversation

@Takexito
Copy link
Contributor

@Takexito Takexito commented Nov 1, 2023

Произведена точечная миграция на skie.
Использовались следующие фичи:

  • flow
  • sealed class
  • enum

}

@MainActor
func activate() async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не очень удобно, что нужно вызывать activate вручную. Можно забыть про него.

нельзя ли сделать этот метод activate приватным и вызвать его в init?

struct PokemonDetailsView: View {
@ObservedObject private var pokemonState: ObservableState<LoadableState<DetailedPokemon>>
@ObservedObject private var voteState: ObservableState<PokemonVoteState>
@ObservedObject private var voteState: ObservableState<__PokemonVoteState>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это то, про что ты писал в доке?

Например Generic c enum вернет ResultWrapper<__Foo>

Почему так происходит?

PokemonDetailsBodyView(
pokemon: pokemon,
voteState: voteState.value,
voteState: voteState.value as PokemonVoteState,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Получается, мы тут кастим __PokemonVoteState к PokemonVoteState?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

да, __PokemonVoteState - это обычный класс от котлина, который имитирует enum. Он нужен что бы мы могли его использовать в дженерике ObservableState
А дальше для удобства использования его кастим к PokemonVoteState, который уже является swift enum

interface HomeComponent {

val childStack: CStateFlow<ChildStack<*, Child>>
@FlowInterop.Enabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Получается, мы должны явно указывать @FlowInterop.Enabled?

Можно ли сделать, чтоб он применялся автоматически к полям всех компонентов?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Есть глобальный конфиг, он указывается в gradle, а есть локальные конфиги, они указываются с помощью аннотаций и перезаписывают глобальный конфиг для конкретного элемента.

Если в глобальном конфиге указать что FlowInterop включен, то эти аннотации не будут нужны. Аналогично и с остальными фичами

Здесь я отключил глобально фичи, что бы можно было на отдельных кусках кода показать возможности и не приходилось править весь остальной код

self.childStack = ObservableStateFlow(flow: component.childStack)
Task.init { [self] in
await self.childStack.activate()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мы тут запускаем Task. Это что-то вроде корутины? А когда она отменится?

let pokemonName = dialogComponent?.dialogData.value.pokemonName ?? .empty

return MR.strings().pokemons_dialog_title.format(args_: [pokemonName]).localized()
return MR.strings().pokemons_dialog_title.format(args: [pokemonName]).localized()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

args_ -> args
Это из-за SKIA так? Или что-то в Моко поменялось?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, это как раз таки одна из фичей, которая улучшает нейминг параметров

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