-
Notifications
You must be signed in to change notification settings - Fork 0
[Feature] 영화 검색 구현 #17
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
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3510c2c
[feat] 영화 리스트 UI 구현
minneee d0b6667
[feat] 검색 UI 구현
minneee ec3e9e4
[feat] 데이터 파싱 구현
minneee 7665847
[feat] 영화 리스트 UI 구현
minneee db74bb8
[feat] 검색 UI 구현
minneee 1cf34f7
[feat] 데이터 파싱 구현
minneee c989ba5
[feat] api 연결
minneee 6f5269f
[chore]origin pull
minneee 21a5d52
[feat] 네트워크 에러처리
minneee 96122ca
[feat] 스크롤 버튼 동작 추가
minneee 3902e61
[feat] 영화 검색 구현
minneee f4b9b54
Merge branch 'main' into feature/search-movie
minneee c2bea06
[chore] 영화 리스트 합치기 로직 수정
minneee badb30d
Merge remote-tracking branch 'origin/feature/search-movie' into featu…
minneee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| // | ||
| // MovieSearchFeature.swift | ||
| // MovieBooking | ||
| // | ||
| // Created by 김민희 on 10/16/25. | ||
| // | ||
|
|
||
| import ComposableArchitecture | ||
| import Foundation | ||
|
|
||
| @Reducer | ||
| struct MovieSearchFeature { | ||
| @ObservableState | ||
| struct State: Equatable { | ||
| var nowPlayingMovies: [Movie] = [] | ||
| var upcomingMovies: [Movie] = [] | ||
| var popularMovies: [Movie] = [] | ||
| var searchText: String = "" | ||
| } | ||
|
|
||
| enum Action: BindableAction { | ||
| case updateMovieLists(nowPlaying: [Movie], upcoming: [Movie], popular: [Movie]) | ||
| case binding(BindingAction<State>) | ||
| } | ||
|
|
||
| var body: some Reducer<State, Action> { | ||
| BindingReducer() | ||
| Reduce { state, action in | ||
| switch action { | ||
| case let .updateMovieLists(nowPlaying, upcoming, popular): | ||
| state.nowPlayingMovies = nowPlaying | ||
| state.upcomingMovies = upcoming | ||
| state.popularMovies = popular | ||
| return .none | ||
|
|
||
| case .binding: | ||
| return .none | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
| extension MovieSearchFeature.State { | ||
| var trimmedKeyword: String { | ||
| searchText.trimmingCharacters(in: .whitespacesAndNewlines) | ||
| } | ||
|
|
||
| var aggregatedMovies: [Movie] { | ||
| Array(Set(nowPlayingMovies + upcomingMovies + popularMovies)) | ||
| } | ||
|
Comment on lines
+49
to
+51
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 어떤 동작인지 잘 모르겠어요
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 영화 목록들이 배열 여러개로 있어서 하나로 합친 로직입니다! 복잡한 것 같아서 간단하게 수정했습니당 |
||
|
|
||
| var filteredMovies: [Movie] { | ||
| guard !trimmedKeyword.isEmpty else { return [] } | ||
|
|
||
| return aggregatedMovies.filter { | ||
| $0.title.localizedCaseInsensitiveContains(trimmedKeyword) | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@minneee 이걸 하나로 합치는거 어떨까요 ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
하나로 합치는게 어떻게 하는걸 말씀하시는거에요??