Skip to content

Commit

Permalink
Merge pull request #582 from wakmusic/575-develop-result-of-search
Browse files Browse the repository at this point in the history
🔀 :: (#575) 검색 곡 결과 화면 구현
  • Loading branch information
yongbeomkwak authored Jun 11, 2024
2 parents d6b5741 + b731625 commit 9e4530b
Show file tree
Hide file tree
Showing 44 changed files with 786 additions and 903 deletions.
4 changes: 2 additions & 2 deletions Projects/App/Sources/Application/AppComponent+Search.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extension AppComponent {
AfterSearchComponent(parent: self)
}

var afterSearchContentComponent: AfterSearchContentComponent {
AfterSearchContentComponent(parent: self)
var songSearchResultFactory: any SongSearchResultFactory {
SongSearchResultComponent(parent: self)
}
}
200 changes: 100 additions & 100 deletions Projects/App/Sources/Application/NeedleGenerated.swift

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public struct SongEntity: Equatable {
public struct SongEntity: Hashable, Equatable {
public init(
id: String,
title: String,
Expand Down Expand Up @@ -29,6 +29,10 @@ public struct SongEntity: Equatable {
public let date: String
public var isSelected: Bool

public func hash(into hasher: inout Hasher) {
hasher.combine(id)
}

public static func == (lhs: SongEntity, rhs: SongEntity) -> Bool {
lhs.id == rhs.id
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {

let fetchPlayListUseCase: FetchPlayListUseCaseStub = .init()

let component =
let wakMucomponent =
WakmusicRecommendViewController(
playlistDetailFactory: PlaylistDetailFactoryStub(),
reactor: WakmusicRecommendReactor(fetchRecommendPlayListUseCase: fetchPlayListUseCase)
)

let component = SongSearchResultViewController(reactor: SongSearchResultReactor())

let viewController = Inject.ViewControllerHost(
UINavigationController(rootViewController: component)
)
Expand Down
13 changes: 13 additions & 0 deletions Projects/Features/SearchFeature/Interface/Enum/TabPosition.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
public enum TabPosition: Int {
case song = 0
case list

var title: String {
switch self {
case .song:
"노래"
case .list:
"리스트"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Foundation

public enum TypingStatus {
case before
case typing
case search
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Foundation
import UIKit

public protocol SongSearchResultFactory {
func makeView() -> UIViewController
}
33 changes: 0 additions & 33 deletions Projects/Features/SearchFeature/Resources/Search.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -62,36 +62,6 @@
</objects>
<point key="canvasLocation" x="1754.9618320610687" y="-2.1126760563380285"/>
</scene>
<!--After Search Content View Controller-->
<scene sceneID="ewL-de-ykJ">
<objects>
<viewController storyboardIdentifier="AfterSearchContentViewController" id="wFs-UV-N8n" customClass="AfterSearchContentViewController" customModule="SearchFeature" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Xtf-ws-O1l">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="AFm-fr-N46">
<rect key="frame" x="0.0" y="115" width="393" height="703"/>
<color key="backgroundColor" name="SUB 1"/>
</tableView>
</subviews>
<viewLayoutGuide key="safeArea" id="rcw-Ju-H6e"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="rcw-Ju-H6e" firstAttribute="trailing" secondItem="AFm-fr-N46" secondAttribute="trailing" id="7tt-pj-WAb"/>
<constraint firstItem="AFm-fr-N46" firstAttribute="top" secondItem="rcw-Ju-H6e" secondAttribute="top" constant="56" id="eIZ-1L-S7b"/>
<constraint firstItem="rcw-Ju-H6e" firstAttribute="bottom" secondItem="AFm-fr-N46" secondAttribute="bottom" id="fma-yd-7O3"/>
<constraint firstItem="AFm-fr-N46" firstAttribute="leading" secondItem="rcw-Ju-H6e" secondAttribute="leading" id="saW-gc-dM6"/>
</constraints>
</view>
<connections>
<outlet property="tableView" destination="AFm-fr-N46" id="6Hf-WL-ueX"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="IVM-sj-ICq" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2491" y="-2"/>
</scene>
<!--검색-->
<scene sceneID="s0d-6b-0kx">
<objects>
Expand Down Expand Up @@ -189,9 +159,6 @@
</scene>
</scenes>
<resources>
<namedColor name="SUB 1">
<color red="0.15294117647058825" green="0.37647058823529411" blue="0.95686274509803926" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="gray100">
<color red="0.94900000095367432" green="0.9570000171661377" blue="0.96899998188018799" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ import BaseFeature
import BaseFeatureInterface
import Foundation
import NeedleFoundation
import SearchFeatureInterface
import SongsDomainInterface

public protocol AfterSearchDependency: Dependency {
var afterSearchContentComponent: AfterSearchContentComponent { get }
var songSearchResultFactory: any SongSearchResultFactory { get }
var containSongsFactory: any ContainSongsFactory { get }
}

public final class AfterSearchComponent: Component<AfterSearchDependency> {
public func makeView() -> AfterSearchViewController {
return AfterSearchViewController.viewController(
afterSearchContentComponent: dependency.afterSearchContentComponent,
songSearchResultFactory: dependency.songSearchResultFactory,
containSongsFactory: dependency.containSongsFactory,
reactor: .init()
)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import BaseFeature
import BaseFeatureInterface
import Foundation
import NeedleFoundation
import SearchFeatureInterface
import UIKit

public final class SongSearchResultComponent: Component<EmptyDependency>, SongSearchResultFactory {
public func makeView() -> UIViewController {
SongSearchResultViewController(reactor: SongSearchResultReactor())
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

#warning("실제 데이터 entity로 바꾸기")

enum BeforeVcDataSoruce: Hashable {
case youtube(model: Model)
case recommend(model2: Model)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import Foundation

enum FilterType {
case all
case title
case artist
case credit

var title: String {
switch self {
case .all:
"전체"
case .title:
"제목"
case .artist:
"아티스트"
case .credit:
"크레딧"
}
}
}

enum SortType {
case newest
case oldest
case likes
case views
case alphabeticalOrder

var title: String {
switch self {
case .newest:
"최신순"
case .oldest:
"과거순"
case .likes:
"좋아요순"
case .views:
"조회수순"
case .alphabeticalOrder:
"가나다순"
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Foundation

internal enum BeforeSearchSection: Int {
case youtube
case recommend
case popularList
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

internal enum RecommendSection: Hashable {
case main
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Foundation

internal enum SongSearchResultSection: Int {
case song = 0

var title: String {
switch self {
case .song:
"노래"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ final class BeforeSearchCollectionViewLayout: UICollectionViewCompositionalLayou
init() {
super.init { sectionIndex, layoutEnvironment in

guard let layoutKind = Section(rawValue: sectionIndex) else { return nil }
guard let layoutKind = BeforeSearchSection(rawValue: sectionIndex) else { return nil }

return BeforeSearchCollectionViewLayout.configureLayoutSection(layoutKind)
}
Expand All @@ -18,13 +18,11 @@ final class BeforeSearchCollectionViewLayout: UICollectionViewCompositionalLayou
}

extension BeforeSearchCollectionViewLayout {
private static func configureLayoutSection(_ layoutKind: Section) -> NSCollectionLayoutSection {
private static func configureLayoutSection(_ layoutKind: BeforeSearchSection) -> NSCollectionLayoutSection {
let itemSize = NSCollectionLayoutSize(
widthDimension: .fractionalWidth(1.0),
heightDimension: .fractionalHeight(1.0)
)
var item: NSCollectionLayoutItem = NSCollectionLayoutItem(layoutSize: itemSize)
item.contentInsets = NSDirectionalEdgeInsets(top: .zero, leading: 8, bottom: 0, trailing: 8)

let headerLayout = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .absolute(30))

Expand All @@ -36,6 +34,9 @@ extension BeforeSearchCollectionViewLayout {

header.contentInsets = .init(top: .zero, leading: 8, bottom: .zero, trailing: 8)

var item: NSCollectionLayoutItem = NSCollectionLayoutItem(layoutSize: itemSize)
item.contentInsets = NSDirectionalEdgeInsets(top: .zero, leading: 8, bottom: 0, trailing: 8)

let group: NSCollectionLayoutGroup
let section: NSCollectionLayoutSection

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import UIKit
import Utility

final class SongSearchResultCollectionViewLayout: UICollectionViewCompositionalLayout {
init() {
super.init { _, _ in

return SongSearchResultCollectionViewLayout.configureLayout()
}
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

extension SongSearchResultCollectionViewLayout {
private static func configureLayout() -> NSCollectionLayoutSection {
let itemSize = NSCollectionLayoutSize(
widthDimension: .fractionalWidth(1.0),
heightDimension: .fractionalHeight(1.0)
)

let headerLayout = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .absolute(30))

let header = NSCollectionLayoutBoundarySupplementaryItem(
layoutSize: headerLayout,
elementKind: SearchResultHeaderView.kind,
alignment: .top
)

let item: NSCollectionLayoutItem = NSCollectionLayoutItem(layoutSize: itemSize)
let groupSize = NSCollectionLayoutSize(
widthDimension: .fractionalWidth(1.0),
heightDimension: .fractionalWidth(0.16)
)
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])

let section = NSCollectionLayoutSection(group: group)
section.contentInsets = NSDirectionalEdgeInsets(top: .zero, leading: 20.0, bottom: 20.0, trailing: 20.0)
section.boundarySupplementaryItems = [header]

return section
}
}
26 changes: 0 additions & 26 deletions Projects/Features/SearchFeature/Sources/Enum/Enum+Search.swift

This file was deleted.

Loading

0 comments on commit 9e4530b

Please sign in to comment.