Skip to content

Commit

Permalink
⚡️ :: [#634] 차트 > 홈으로 이동
Browse files Browse the repository at this point in the history
  • Loading branch information
KangTaeHoon committed Jun 21, 2024
1 parent 3873ec9 commit daf4f60
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 106 deletions.
3 changes: 2 additions & 1 deletion Projects/App/Sources/Application/AppComponent+Chart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import BaseFeature
import ChartDomain
import ChartDomainInterface
import ChartFeature
import ChartFeatureInterface

public extension AppComponent {
var chartComponent: ChartComponent {
var chartFactory: any ChartFactory {
ChartComponent(parent: self)
}

Expand Down
72 changes: 56 additions & 16 deletions Projects/Features/ChartFeature/Resources/Chart.storyboard
Original file line number Diff line number Diff line change
@@ -1,26 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Y6W-OH-hqX">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Y6W-OH-hqX">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--차트-->
<!--Chart View Controller-->
<scene sceneID="s0d-6b-0kx">
<objects>
<viewController storyboardIdentifier="ChartViewController" id="Y6W-OH-hqX" customClass="ChartViewController" customModule="ChartFeature" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3Xq-8x-YBO">
<rect key="frame" x="0.0" y="59" width="393" height="48"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="T6j-Yq-D0z">
<rect key="frame" x="15" y="0.0" width="40" height="48"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="a2h-5Z-jms"/>
</constraints>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<connections>
<action selector="backButtonAction:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="vLv-kM-OiX"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rZb-kR-YGX">
<rect key="frame" x="175.66666666666666" y="13.666666666666671" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="rZb-kR-YGX" firstAttribute="centerY" secondItem="3Xq-8x-YBO" secondAttribute="centerY" id="OFJ-vq-td0"/>
<constraint firstAttribute="bottom" secondItem="T6j-Yq-D0z" secondAttribute="bottom" id="VgK-e4-eFu"/>
<constraint firstItem="T6j-Yq-D0z" firstAttribute="top" secondItem="3Xq-8x-YBO" secondAttribute="top" id="X84-qK-Cmx"/>
<constraint firstAttribute="height" constant="48" id="afq-kW-Qjz"/>
<constraint firstItem="rZb-kR-YGX" firstAttribute="centerX" secondItem="3Xq-8x-YBO" secondAttribute="centerX" id="hea-Cq-2jV"/>
<constraint firstItem="T6j-Yq-D0z" firstAttribute="leading" secondItem="3Xq-8x-YBO" secondAttribute="leading" constant="15" id="pbg-61-2vy"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Woh-2x-vBJ">
<rect key="frame" x="0.0" y="107" width="393" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="67G-4F-cHZ"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
<color key="backgroundColor" name="gray100"/>
<constraints>
<constraint firstItem="Woh-2x-vBJ" firstAttribute="top" secondItem="3Xq-8x-YBO" secondAttribute="bottom" id="5J3-Fy-Np1"/>
<constraint firstItem="Woh-2x-vBJ" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" id="CTF-Hm-woC"/>
<constraint firstAttribute="trailing" secondItem="3Xq-8x-YBO" secondAttribute="trailing" id="Ycz-CO-Gaa"/>
<constraint firstItem="3Xq-8x-YBO" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" id="ojG-zT-BOC"/>
<constraint firstItem="3Xq-8x-YBO" firstAttribute="top" secondItem="vDu-zF-Fre" secondAttribute="top" id="xRA-I5-jxj"/>
<constraint firstItem="Woh-2x-vBJ" firstAttribute="trailing" secondItem="vDu-zF-Fre" secondAttribute="trailing" id="zGV-UW-Cwo"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="차트" id="FVW-eT-hiu"/>
<simulatedTabBarMetrics key="simulatedBottomBarMetrics"/>
<connections>
<outlet property="backButton" destination="T6j-Yq-D0z" id="iHM-VM-g4W"/>
<outlet property="naviTitleLabel" destination="rZb-kR-YGX" id="bp7-9c-RtZ"/>
<outlet property="tabBarContentView" destination="Woh-2x-vBJ" id="xBM-AG-clq"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
Expand All @@ -34,14 +83,8 @@
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yoP-bw-WWh">
<rect key="frame" x="0.0" y="59" width="393" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="7hQ-vR-KV8"/>
</constraints>
</view>
<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="TTu-Bc-teJ">
<rect key="frame" x="0.0" y="99" width="393" height="753"/>
<rect key="frame" x="0.0" y="147" width="393" height="705"/>
<color key="backgroundColor" red="0.94117647059999998" green="0.95294117649999999" blue="0.96470588239999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</tableView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="08x-kK-r7k" customClass="NVActivityIndicatorView" customModule="NVActivityIndicatorView">
Expand All @@ -55,10 +98,7 @@
<viewLayoutGuide key="safeArea" id="QPb-FV-zYU"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="TTu-Bc-teJ" firstAttribute="top" secondItem="yoP-bw-WWh" secondAttribute="bottom" id="2tH-Ar-fig"/>
<constraint firstItem="yoP-bw-WWh" firstAttribute="trailing" secondItem="QPb-FV-zYU" secondAttribute="trailing" id="NI0-Cp-YRw"/>
<constraint firstItem="yoP-bw-WWh" firstAttribute="top" secondItem="QPb-FV-zYU" secondAttribute="top" id="QdO-SW-Iz4"/>
<constraint firstItem="yoP-bw-WWh" firstAttribute="leading" secondItem="QPb-FV-zYU" secondAttribute="leading" id="b13-5G-Bzr"/>
<constraint firstItem="TTu-Bc-teJ" firstAttribute="top" secondItem="QPb-FV-zYU" secondAttribute="top" constant="88" id="3kx-Bc-z7V"/>
<constraint firstItem="TTu-Bc-teJ" firstAttribute="leading" secondItem="QPb-FV-zYU" secondAttribute="leading" id="cBY-xg-9yG"/>
<constraint firstAttribute="trailing" secondItem="TTu-Bc-teJ" secondAttribute="trailing" id="d0B-oT-Pvp"/>
<constraint firstAttribute="bottom" secondItem="TTu-Bc-teJ" secondAttribute="bottom" id="dVN-0P-aVL"/>
Expand All @@ -73,7 +113,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="asS-pX-AFT" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1680" y="-2"/>
<point key="canvasLocation" x="862" y="-2"/>
</scene>
</scenes>
<resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import Then
import UIKit
import Utility

public class ChartContentViewController: BaseViewController, ViewControllerFromStoryBoard, SongCartViewType {
public final class ChartContentViewController: BaseViewController, ViewControllerFromStoryBoard, SongCartViewType {
private let disposeBag = DisposeBag()
private var viewModel: ChartContentViewModel!

fileprivate lazy var input = ChartContentViewModel.Input()
fileprivate lazy var output = viewModel.transform(from: input)
private lazy var input = ChartContentViewModel.Input()
private lazy var output = viewModel.transform(from: input)

@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var activityIncidator: NVActivityIndicatorView!
Expand All @@ -27,6 +27,8 @@ public class ChartContentViewController: BaseViewController, ViewControllerFromS

private var containSongsFactory: ContainSongsFactory!

deinit { DEBUG_LOG("\(Self.self) Deinit") }

override public func viewDidLoad() {
super.viewDidLoad()
configureUI()
Expand All @@ -50,9 +52,9 @@ public class ChartContentViewController: BaseViewController, ViewControllerFromS
}
}

extension ChartContentViewController {
private func bind() {
tableView.register(ChartContentTableViewCell.self, forCellReuseIdentifier: "chartContentTableViewCell")
private extension ChartContentViewController {
func bind() {
tableView.register(ChartContentTableViewCell.self, forCellReuseIdentifier: "\(ChartContentTableViewCell.self)")
tableView.rx.setDelegate(self).disposed(by: disposeBag)

tableView.rx.itemSelected
Expand All @@ -66,7 +68,7 @@ extension ChartContentViewController {
.disposed(by: disposeBag)
}

private func outputBind() {
func outputBind() {
output.dataSource
.skip(1)
.do(onNext: { [weak self] model in
Expand All @@ -93,7 +95,7 @@ extension ChartContentViewController {
guard let self else { return UITableViewCell() }
let indexPath: IndexPath = IndexPath(row: index, section: 0)
guard let cell = tableView.dequeueReusableCell(
withIdentifier: "chartContentTableViewCell",
withIdentifier: "\(ChartContentTableViewCell.self)",
for: indexPath
) as? ChartContentTableViewCell else {
return UITableViewCell()
Expand Down Expand Up @@ -135,13 +137,11 @@ extension ChartContentViewController {
.disposed(by: disposeBag)
}

private func configureUI() {
view.backgroundColor = DesignSystemAsset.GrayColor.gray100.color
func configureUI() {
view.backgroundColor = DesignSystemAsset.BlueGrayColor.gray100.color
self.activityIncidator.type = .circleStrokeSpin
self.activityIncidator.color = DesignSystemAsset.PrimaryColor.point.color
self.activityIncidator.startAnimating()
self.tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: APP_WIDTH(), height: PLAYER_HEIGHT()))
self.tableView.verticalScrollIndicatorInsets = UIEdgeInsets(top: 0, left: 0, bottom: PLAYER_HEIGHT(), right: 0)
self.tableView.refreshControl = refreshControl
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import UIKit
import Utility

public final class ChartViewController: TabmanViewController, ViewControllerFromStoryBoard, EqualHandleTappedType {
private var chartContentComponent: ChartContentComponent?
@IBOutlet weak var backButton: UIButton!
@IBOutlet weak var naviTitleLabel: UILabel!
@IBOutlet weak var tabBarContentView: UIView!

private var chartContentComponent: ChartContentComponent?
private lazy var viewControllers: [ChartContentViewController?] = {
let viewControllers = [
chartContentComponent?.makeView(type: .hourly),
Expand All @@ -19,27 +22,40 @@ public final class ChartViewController: TabmanViewController, ViewControllerFrom
return viewControllers
}()

private let tabBarContentView = UIView()
deinit { DEBUG_LOG("\(Self.self) Deinit") }

override public func viewDidLoad() {
super.viewDidLoad()
configureUI()
}

public static func viewController(chartContentComponent: ChartContentComponent) -> ChartViewController {
let viewController = ChartViewController.viewController(storyBoardName: "Chart", bundle: Bundle.module)
let viewController = ChartViewController.viewController(
storyBoardName: "Chart",
bundle: ChartFeatureResources.bundle
)
viewController.chartContentComponent = chartContentComponent
return viewController
}

@IBAction func backButtonAction(_ sender: Any) {
navigationController?.popViewController(animated: true)
}
}

extension ChartViewController {
private func configureUI() {
private extension ChartViewController {
func configureUI() {
backButton.setImage(DesignSystemAsset.Navigation.back.image, for: .normal)
naviTitleLabel.text = "왁뮤차트 TOP100"
naviTitleLabel.textColor = DesignSystemAsset.BlueGrayColor.blueGray900.color
naviTitleLabel.font = DesignSystemFontFamily.Pretendard.medium.font(size: 16)
naviTitleLabel.setTextWithAttributes(alignment: .center)

self.dataSource = self
let bar = TMBar.ButtonBar()

// 배경색
bar.backgroundView.style = .flat(color: DesignSystemAsset.GrayColor.gray100.color)
bar.backgroundView.style = .flat(color: DesignSystemAsset.BlueGrayColor.gray100.color)

// 간격 설정
bar.layout.contentInset = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20)
Expand All @@ -48,8 +64,8 @@ extension ChartViewController {

// 버튼 글씨 커스텀
bar.buttons.customize { button in
button.tintColor = DesignSystemAsset.GrayColor.gray400.color
button.selectedTintColor = DesignSystemAsset.GrayColor.gray900.color
button.tintColor = DesignSystemAsset.BlueGrayColor.gray400.color
button.selectedTintColor = DesignSystemAsset.BlueGrayColor.gray900.color
button.font = DesignSystemFontFamily.Pretendard.medium.font(size: 16)
button.selectedFont = DesignSystemFontFamily.Pretendard.bold.font(size: 16)
}
Expand All @@ -59,16 +75,10 @@ extension ChartViewController {
bar.indicator.tintColor = DesignSystemAsset.PrimaryColor.point.color
bar.indicator.overscrollBehavior = .compress

view.addSubview(tabBarContentView)
tabBarContentView.snp.makeConstraints {
$0.top.horizontalEdges.equalTo(view.safeAreaLayoutGuide)
$0.height.equalTo(40)
}

addBar(bar, dataSource: self, at: .custom(view: self.tabBarContentView, layout: nil))
bar.layer.addBorder(
[.bottom],
color: DesignSystemAsset.GrayColor.gray300.color.withAlphaComponent(0.4),
color: DesignSystemAsset.BlueGrayColor.gray300.color.withAlphaComponent(0.4),
height: 1
)
}
Expand Down
Loading

0 comments on commit daf4f60

Please sign in to comment.