Skip to content

Commit

Permalink
Merge branch 'feat/#104-SortingAnime' into feat/#106-ShowcaseDefaultP…
Browse files Browse the repository at this point in the history
…layer
  • Loading branch information
HyunJaeyeon committed Nov 30, 2024
2 parents 04b70fd + 85551da commit d7dbc59
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,13 @@ struct AnimeSelectView: View {

/// 현재 보여지는 애니 리스트
private var currentAnimes: [Anime] {
let sortedAnimes = animes.sorted { $0.title.localizedCompare($1.title) == .orderedAscending }
if searchText.isEmpty {
return animes
return sortedAnimes
} else {
// 검색어 공백 제거
let normalizedSearchText = searchText.replacingOccurrences(of: " ", with: "")
return animes.filter {
return sortedAnimes.filter {
// 애니 제목 공백 제거
let normalizedTitle = $0.title.replacingOccurrences(of: " ", with: "")
return normalizedTitle.localizedCaseInsensitiveContains(normalizedSearchText)
Expand Down

0 comments on commit d7dbc59

Please sign in to comment.