Skip to content

Commit

Permalink
Fix iOS methods for favoriting a breed
Browse files Browse the repository at this point in the history
  • Loading branch information
bpedryc committed Jul 3, 2023
1 parent 07311be commit bdae045
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions ios/KaMPKitiOS/Breeds/BreedsScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct BreedsScreen: View {
var body: some View {
BreedsContent(
state: viewModel.state,
onBreedFavorite: { viewModel.onBreedFavorite(breed: $0) },
onBreedFavorite: { viewModel.onBreedFavorite($0) },
refresh: { viewModel.refresh() }
)
.onAppear(perform: {
Expand All @@ -30,15 +30,15 @@ struct BreedsScreen: View {

struct BreedsContent: View {
var state: BreedsViewState
var onBreedFavorite: (Breed) -> Void
var onBreedFavorite: (Int64) -> Void
var refresh: () -> Void

var body: some View {
ZStack {
VStack {
List(state.breeds, id: \.id) { breed in
BreedRowView(breed: breed) {
onBreedFavorite(breed)
onBreedFavorite(breed.id)
}
}
if let error = state.error {
Expand Down
4 changes: 2 additions & 2 deletions ios/KaMPKitiOS/Breeds/BreedsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class BreedsViewModel: ObservableObject {
cancellables.removeAll()
}

func onBreedFavorite(_ breed: Breed) {
viewModelDelegate.updateBreedFavorite(breed: breed)
func onBreedFavorite(_ breedId: Int64) {
viewModelDelegate.updateBreedFavorite(breedId: breedId)
}

func refresh() {
Expand Down

0 comments on commit bdae045

Please sign in to comment.