Repository: Automattic/pocket-casts-ios
File: podcasts/New Search/Views/Results/PredictiveList.swift (Swift)

Code before:
import SwiftUI
import PocketCastsUtils
import PocketCastsServer

struct PredictiveList: View {

    @EnvironmentObject var theme: Theme
    @EnvironmentObject var searchAnalyticsHelper: SearchAnalyticsHelper
    @EnvironmentObject var searchResults: SearchResultsModel
    @EnvironmentObject var searchHistory: SearchHistoryModel

    var termsResults: [PredictiveSearchResult] {
        searchResults.predictive.filter { result in
            if case .term = result.type {
                return true
            } else {
                return false
            }
        }
    }

    var nonTermsResults: [PredictiveSearchResult] {
        let podcastsUuids = searchResults.podcasts.map({ result in
            result.uuid
        })
        return searchResults.predictive.filter { result in
            switch result.type {
                case .podcast(let podcast):
                    return !podcastsUuids.contains { uuid in
                        uuid == podcast.uuid
                    }
                default:
                    return false
            }
        }
    }

    var body: some View {
        ForEach(termsResults, id: \.self) { predictiveSearch in
            predictiveRow(for: predictiveSearch)
        }
        ForEach(searchResults.podcasts, id: \.self) { localPodcast in
            SearchResultCell(episode: nil, result: localPodcast, played: false, showDivider: !FeatureFlag.searchImprovements.enabled, cellStyle: ListCellButtonStyle(backgroundStyle: .primaryUi01))

Review comment (suggestion):
Maybe just return false directly with no else?
```suggestion
            }
            return false
```

Code after:
import SwiftUI
import PocketCastsUtils
import PocketCastsServer

struct PredictiveList: View {

    @EnvironmentObject var theme: Theme
    @EnvironmentObject var searchAnalyticsHelper: SearchAnalyticsHelper
    @EnvironmentObject var searchResults: SearchResultsModel
    @EnvironmentObject var searchHistory: SearchHistoryModel

    var termsResults: [PredictiveSearchResult] {
        searchResults.predictive.filter { result in
            if case .term = result.type {
                return true
            }
            return false
        }
    }

    var nonTermsResults: [PredictiveSearchResult] {
        let podcastsUuids = searchResults.podcasts.map({ result in
            result.uuid
        })
        return searchResults.predictive.filter { result in
            switch result.type {
                case .podcast(let podcast):
                    return !podcastsUuids.contains { uuid in
                        uuid == podcast.uuid
                    }
                default:
                    return false
            }
        }
    }

    var body: some View {
        ForEach(termsResults, id: \.self) { predictiveSearch in
            predictiveRow(for: predictiveSearch)
        }
        ForEach(searchResults.podcasts, id: \.self) { localPodcast in
            SearchResultCell(episode: nil, result: localPodcast, played: false, showDivider: !FeatureFlag.searchImprovements.enabled, cellStyle: ListCellButtonStyle(backgroundStyle: .primaryUi01))
                .listRowBackground(theme.primaryUi01)