Skip to content

Fix: static을 제거하여 전역 접근 제거 #8

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

Merged
merged 4 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class RecipeListViewModel: InputRecipeListViewModel, OutputRecipeListViewModel {
private let disposeBag = DisposeBag()
private let fetchFeedListUseCase: FetchFeedListUseCase
private let searchFeedListUseCase: SearchFeedListUseCase
private let mapper = RecipeMapper()

Choose a reason for hiding this comment

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

recipeListMapper로 더 명확한 네이밍을 가지면 좋을 것 같은데 어떻게 생각하시나요?

Copy link
Collaborator Author

@GeonH0 GeonH0 Jun 19, 2024

Choose a reason for hiding this comment

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

d529f15 변경했습니다!

Choose a reason for hiding this comment

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

좋아요! RecipeMapper 요 객체도 같이 변경되었으면 해요~
아무래도 레시피 서비스다 보니 Recipe로 시작하는 Mapper가 더 생길 것 같아서 명확히 하는게 좋을 것 같아요 😄

Copy link
Collaborator Author

@GeonH0 GeonH0 Jun 20, 2024

Choose a reason for hiding this comment

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

b5669b5
RecipeFetchMapper로 네이밍 변경했습니다!

private weak var delegate: RecipeListViewModelDelegate?

private var currentPage: Int = 1
Expand Down Expand Up @@ -88,7 +89,7 @@ class RecipeListViewModel: InputRecipeListViewModel, OutputRecipeListViewModel {
guard let recipe = allRecipes.first(where: { $0.id == id }) else {
return nil
}
return RecipeMapper.mapToRecipeItemViewModel(from: recipe)
return mapper.mapToRecipeItemViewModel(from: recipe)
}

func resetSearch() {
Expand Down Expand Up @@ -138,7 +139,7 @@ class RecipeListViewModel: InputRecipeListViewModel, OutputRecipeListViewModel {
} else {
allRecipes.append(contentsOf: recipes)
}
let recipeViewModels = RecipeMapper.mapToRecipeListItemViewModels(from: recipes)
let recipeViewModels = mapper.mapToRecipeListItemViewModels(from: recipes)
var currentRecipes = try! recipesSubject.value()
if isSearching {
currentRecipes = recipeViewModels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import Foundation

struct RecipeMapper {
static func mapToRecipeListItemViewModels(from recipes: [Recipe]) -> [RecipeListItemViewModel] {
func mapToRecipeListItemViewModels(from recipes: [Recipe]) -> [RecipeListItemViewModel] {
return recipes.map { RecipeListItemViewModel(recipe: $0) }
}

static func mapToRecipeItemViewModel(from recipe: Recipe) -> RecipeItemViewModel {
func mapToRecipeItemViewModel(from recipe: Recipe) -> RecipeItemViewModel {
return RecipeItemViewModel(recipe: recipe)
}
}
Loading