Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
8ca197f
feat: CoreDataManager 싱글톤 제거
jihyeonjjang Jun 12, 2025
a0eb032
feat: 각 ViewModel마다 의존성 주입
jihyeonjjang Jun 12, 2025
9acb369
chore: MainViewController -> TabBarViewController
jihyeonjjang Jun 12, 2025
026790a
feat: DIContainer 생성 및 CoreDataManager, VideoService 의존성 주입 구현
jihyeonjjang Jun 12, 2025
406dbfc
refactor: 런치 화면 코드 기반 전환 및 스토리보드 정리
jihyeonjjang Jun 12, 2025
3a11b4d
refactor: TabBarViewController에서 CoreDataManager 직접 참조 제거 및 ViewModel…
jihyeonjjang Jun 12, 2025
48bd197
refactor: LaunchScreenViewController의 초기 진입 로직 ViewModel로 분리
jihyeonjjang Jun 12, 2025
d817971
refactor: Video fetch 요청 시 id 기준 오름차순 정렬 추가
jihyeonjjang Jun 12, 2025
8215255
feat: 시작 스토리보드 파일 Main으로 다시 설정
jihyeonjjang Jun 12, 2025
698d82e
chore: SceneDelegate 변경사항 삭제
jihyeonjjang Jun 12, 2025
ce784aa
chore: DIContainer 삭제
jihyeonjjang Jun 12, 2025
f21f021
feat: LaunchScreenView 삭제 및 TabBarController로 Initial 지정
jihyeonjjang Jun 12, 2025
81a4c66
feat: storyboardIdentifier 지정
jihyeonjjang Jun 12, 2025
85ae403
refactor: TabBarViewModel 내 ViewController 인스턴스화를 스토리보드 방식으로 전환
jihyeonjjang Jun 12, 2025
32ebef9
refactor: TabBarViewModel에서 스토리보드를 연결하기 때문에 stroyboard reference 제거
jihyeonjjang Jun 12, 2025
35a1aa8
feat: HomeViewModel 생성
jihyeonjjang Jun 12, 2025
70aa9ee
refactor: 탭별 ViewController의 스토리보드 인스턴스화 코드 개선
jihyeonjjang Jun 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions PickaView/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<device id="retina4_0" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23721"/>
Expand All @@ -14,20 +14,20 @@
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalCentering" alignment="center" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="YLO-KL-CHG">
<rect key="frame" x="30" y="312.33333333333331" width="333" height="227.33333333333331"/>
<rect key="frame" x="-32" y="189.5" width="384" height="189"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Logo" translatesAutoresizingMaskIntoConstraints="NO" id="KYe-4k-NpH">
<rect key="frame" x="0.0" y="0.0" width="333" height="166.66666666666666"/>
<rect key="frame" x="64" y="0.0" width="256" height="128"/>
<constraints>
<constraint firstAttribute="width" secondItem="KYe-4k-NpH" secondAttribute="height" multiplier="2:1" id="uzG-k3-EAn"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PICK A VIEW" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dZB-Gs-VmG">
<rect key="frame" x="71.333333333333329" y="186.66666666666669" width="190.33333333333337" height="40.666666666666657"/>
<rect key="frame" x="97" y="148" width="190.5" height="41"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle0"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand All @@ -38,9 +38,11 @@
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="YLO-KL-CHG" firstAttribute="width" secondItem="6Tk-OE-BBY" secondAttribute="height" multiplier="1:2" id="n3y-NX-5Pe"/>
<constraint firstItem="YLO-KL-CHG" firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="6Tk-OE-BBY" secondAttribute="trailing" constant="32" id="3PB-sa-dzB"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="YLO-KL-CHG" secondAttribute="leading" constant="32" id="4eI-F3-IbC"/>
<constraint firstItem="YLO-KL-CHG" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="o6m-4Y-21T"/>
<constraint firstItem="YLO-KL-CHG" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="wgg-rx-ILH"/>
<constraint firstItem="KYe-4k-NpH" firstAttribute="width" secondItem="Ze5-6b-2t3" secondAttribute="width" multiplier="0.8" id="x8n-KJ-pW0"/>
</constraints>
</view>
</viewController>
Expand Down
91 changes: 3 additions & 88 deletions PickaView/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,111 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="T1G-iv-UrV">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23721"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Launch Screen View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="LaunchScreenViewController" customModule="PickaView" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalCentering" alignment="center" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="TK8-wB-Znq">
<rect key="frame" x="30" y="312.33333333333331" width="333" height="227.33333333333331"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Logo" translatesAutoresizingMaskIntoConstraints="NO" id="vLo-hf-3mv">
<rect key="frame" x="0.0" y="0.0" width="333" height="166.66666666666666"/>
<constraints>
<constraint firstAttribute="width" secondItem="vLo-hf-3mv" secondAttribute="height" multiplier="2:1" id="GjC-Rs-eU4"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PICK A VIEW" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WHn-bP-UpJ">
<rect key="frame" x="71.333333333333329" y="186.66666666666669" width="190.33333333333337" height="40.666666666666657"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle0"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="TK8-wB-Znq" firstAttribute="width" secondItem="6Tk-OE-BBY" secondAttribute="height" multiplier="1:2" id="4Fv-MW-Kmi"/>
<constraint firstItem="TK8-wB-Znq" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="76f-oH-nca"/>
<constraint firstItem="TK8-wB-Znq" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="f85-Lb-OQ9"/>
</constraints>
</view>
<connections>
<segue destination="T1G-iv-UrV" kind="presentation" identifier="ReplaceSegue" modalPresentationStyle="fullScreen" id="XFa-Lu-XMY"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="152" y="-51"/>
</scene>
<!--Home-->
<scene sceneID="UEe-yM-Otl">
<objects>
<viewControllerPlaceholder storyboardName="Home" id="e2u-q1-NAk" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Item" id="rUf-eL-VLf"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="vcV-ee-1tI" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1978" y="-230"/>
</scene>
<!--Like-->
<scene sceneID="aI9-FB-CNU">
<objects>
<viewControllerPlaceholder storyboardName="Like" id="GXV-pb-Ooy" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Item" id="Pln-jd-2id"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="AeG-2a-2xe" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1978" y="-51"/>
</scene>
<!--MyPage-->
<scene sceneID="Twr-vB-NQh">
<objects>
<viewControllerPlaceholder storyboardName="MyPage" id="4YG-MR-fvA" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Item" id="Nnn-ZW-1IV"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="QIv-F6-0vW" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1978" y="120"/>
</scene>
<!--Main View Controller-->
<!--Tab Bar View Controller-->
<scene sceneID="kSv-3O-sWd">
<objects>
<tabBarController automaticallyAdjustsScrollViewInsets="NO" id="T1G-iv-UrV" customClass="MainViewController" customModule="PickaView" customModuleProvider="target" sceneMemberID="viewController">
<tabBarController automaticallyAdjustsScrollViewInsets="NO" id="T1G-iv-UrV" customClass="TabBarViewController" customModule="PickaView" customModuleProvider="target" sceneMemberID="viewController">
<toolbarItems/>
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="nKz-Te-FSR">
<rect key="frame" x="0.0" y="0.0" width="1000" height="1000"/>
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tabBar>
<connections>
<segue destination="e2u-q1-NAk" kind="relationship" relationship="viewControllers" id="I7Q-aZ-nqf"/>
<segue destination="GXV-pb-Ooy" kind="relationship" relationship="viewControllers" id="llo-kA-2af"/>
<segue destination="4YG-MR-fvA" kind="relationship" relationship="viewControllers" id="m1c-4n-Xmd"/>
</connections>
</tabBarController>
<placeholder placeholderIdentifier="IBFirstResponder" id="3pZ-GI-xee" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1164" y="-51"/>
</scene>
</scenes>
<resources>
<image name="Logo" width="512" height="512"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
11 changes: 5 additions & 6 deletions PickaView/Data/Persistence/CoreDataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ import Foundation
import CoreData

final class CoreDataManager {
static let shared = CoreDataManager()

let persistentContainer: NSPersistentContainer
let mainContext: NSManagedObjectContext
let fetchedResults: NSFetchedResultsController<Video>

private init() {
init() {
// Core Data 스택 초기화
let container = NSPersistentContainer(name: "Model")
container.loadPersistentStores { storeDescription, error in
Expand All @@ -26,10 +24,11 @@ final class CoreDataManager {
persistentContainer = container
mainContext = container.viewContext

let request: NSFetchRequest<Video> = Video.fetchRequest()
let fetchRequest: NSFetchRequest<Video> = Video.fetchRequest()
fetchRequest.sortDescriptors = [NSSortDescriptor(key: "id", ascending: true)]

fetchedResults = NSFetchedResultsController(
fetchRequest: request,
fetchRequest: fetchRequest,
managedObjectContext: mainContext,
sectionNameKeyPath: nil,
cacheName: nil
Expand Down Expand Up @@ -118,6 +117,6 @@ final class CoreDataManager {
tag.lastUpdated = Date()
}

CoreDataManager.shared.saveContext()
self.saveContext()
}
}
2 changes: 1 addition & 1 deletion PickaView/Data/UserDefault/ThemeManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class ThemeManager {
/**
저장된 테마 설정을 앱의 모든 윈도우에 즉시 적용함.

앱이 시작될 때 `MainViewController`에서 호출됨.
앱이 시작될 때 `TabBarViewController`에서 호출됨.
*/
func applyTheme() {
let themeIndex = UserDefaults.standard.integer(forKey: themeKey)
Expand Down
1 change: 0 additions & 1 deletion PickaView/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
//
// MainViewController.swift
// TabBarViewController.swift
// PickaView
//
// Created by Ko Minhyuk on 6/10/25.
//

import UIKit

class MainViewController: UITabBarController {

class TabBarViewController: UITabBarController {
private let viewModel = TabBarViewModel()

override func viewDidLoad() {
super.viewDidLoad()

ThemeManager.shared.applyTheme()
print("initial")

viewControllers = viewModel.makeTabViewControllers()
}
}
2 changes: 1 addition & 1 deletion PickaView/Views/Home/Home.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<!--Home-->
<scene sceneID="nE6-a6-IVI">
<objects>
<viewController id="HZY-Ch-Qe1" customClass="HomeViewController" customModule="PickaView" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="HomeViewController" id="HZY-Ch-Qe1" customClass="HomeViewController" customModule="PickaView" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="4L5-1a-Lg2">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand Down
2 changes: 2 additions & 0 deletions PickaView/Views/Home/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import UIKit

class HomeViewController: UIViewController {

var viewModel: HomeViewModel!

@IBOutlet weak var titleLabel: UILabel!

Expand Down
16 changes: 16 additions & 0 deletions PickaView/Views/Home/HomeViewModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// HomeViewModel.swift
// PickaView
//
// Created by 장지현 on 6/13/25.
//

final class HomeViewModel {
private let coreDataManager: CoreDataManager
private let pixabayVideoService: PixabayVideoService

init(coreDataManager: CoreDataManager, pixabayVideoService: PixabayVideoService) {
self.coreDataManager = coreDataManager
self.pixabayVideoService = pixabayVideoService
}
}
28 changes: 0 additions & 28 deletions PickaView/Views/LaunchScreen/LaunchScreenViewController.swift

This file was deleted.

2 changes: 1 addition & 1 deletion PickaView/Views/Like/Like.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!--Like View Controller-->
<scene sceneID="s0d-6b-0kx">
<objects>
<viewController id="Y6W-OH-hqX" customClass="LikeViewController" customModule="PickaView" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="LikeViewController" id="Y6W-OH-hqX" customClass="LikeViewController" customModule="PickaView" customModuleProvider="target" 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"/>
Expand Down
2 changes: 1 addition & 1 deletion PickaView/Views/MyPage/MyPage.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!--Setting-->
<scene sceneID="g9e-EM-NR9">
<objects>
<viewController id="oSK-Jy-vbr" customClass="MyPageViewController" customModule="PickaView" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="MyPageViewController" id="oSK-Jy-vbr" customClass="MyPageViewController" customModule="PickaView" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="dAa-rk-RtC">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand Down
Loading