From 5d3d09428d0266eb38573c2784a8dbb6ded6f893 Mon Sep 17 00:00:00 2001 From: iOS-Yetti Date: Tue, 29 Aug 2023 09:46:23 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20CollectionView=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EB=B0=8F=20ListCell=20=EA=B5=AC=ED=98=84=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .swiftlint.yml | 4 +- Diary.xcodeproj/project.pbxproj | 38 ++++++++++++++++--- Diary/Controller/ViewController.swift | 22 +++++++++++ Diary/{ => Resource}/AppDelegate.swift | 0 .../AccentColor.colorset/Contents.json | 0 .../AppIcon.appiconset/Contents.json | 0 .../Assets.xcassets/Contents.json | 0 Diary/{ => Resource}/SceneDelegate.swift | 4 +- .../Base.lproj/LaunchScreen.storyboard | 0 Diary/View/DiaryCollectionViewListCell.swift | 32 ++++++++++++++++ Diary/ViewController.swift | 14 ------- 11 files changed, 90 insertions(+), 24 deletions(-) create mode 100644 Diary/Controller/ViewController.swift rename Diary/{ => Resource}/AppDelegate.swift (100%) rename Diary/{ => Resource}/Assets.xcassets/AccentColor.colorset/Contents.json (100%) rename Diary/{ => Resource}/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename Diary/{ => Resource}/Assets.xcassets/Contents.json (100%) rename Diary/{ => Resource}/SceneDelegate.swift (96%) rename Diary/{ => View}/Base.lproj/LaunchScreen.storyboard (100%) create mode 100644 Diary/View/DiaryCollectionViewListCell.swift delete mode 100644 Diary/ViewController.swift diff --git a/.swiftlint.yml b/.swiftlint.yml index 8e7dd4857..f8413c493 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,3 +1,3 @@ excluded: - - Diary/AppDelegate.swift - - Diary/SceneDelegate.swift + - Diary/Resource/AppDelegate.swift + - Diary/Resource/SceneDelegate.swift diff --git a/Diary.xcodeproj/project.pbxproj b/Diary.xcodeproj/project.pbxproj index eab2810e1..c81179880 100644 --- a/Diary.xcodeproj/project.pbxproj +++ b/Diary.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 3BBC98902A9D73D70047DE81 /* DiaryCollectionViewListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BBC988F2A9D73D70047DE81 /* DiaryCollectionViewListCell.swift */; }; C739AE25284DF28600741E8F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C739AE24284DF28600741E8F /* AppDelegate.swift */; }; C739AE27284DF28600741E8F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C739AE26284DF28600741E8F /* SceneDelegate.swift */; }; C739AE29284DF28600741E8F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C739AE28284DF28600741E8F /* ViewController.swift */; }; @@ -17,6 +18,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 3BBC988F2A9D73D70047DE81 /* DiaryCollectionViewListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiaryCollectionViewListCell.swift; sourceTree = ""; }; C739AE21284DF28600741E8F /* Diary.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Diary.app; sourceTree = BUILT_PRODUCTS_DIR; }; C739AE24284DF28600741E8F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; C739AE26284DF28600741E8F /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -39,6 +41,33 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 3BBC988C2A9D67EC0047DE81 /* Resource */ = { + isa = PBXGroup; + children = ( + C739AE24284DF28600741E8F /* AppDelegate.swift */, + C739AE26284DF28600741E8F /* SceneDelegate.swift */, + C739AE30284DF28600741E8F /* Assets.xcassets */, + ); + path = Resource; + sourceTree = ""; + }; + 3BBC988D2A9D68290047DE81 /* Controller */ = { + isa = PBXGroup; + children = ( + C739AE28284DF28600741E8F /* ViewController.swift */, + ); + path = Controller; + sourceTree = ""; + }; + 3BBC988E2A9D683C0047DE81 /* View */ = { + isa = PBXGroup; + children = ( + C739AE32284DF28600741E8F /* LaunchScreen.storyboard */, + 3BBC988F2A9D73D70047DE81 /* DiaryCollectionViewListCell.swift */, + ); + path = View; + sourceTree = ""; + }; C739AE18284DF28600741E8F = { isa = PBXGroup; children = ( @@ -59,11 +88,9 @@ C739AE23284DF28600741E8F /* Diary */ = { isa = PBXGroup; children = ( - C739AE24284DF28600741E8F /* AppDelegate.swift */, - C739AE26284DF28600741E8F /* SceneDelegate.swift */, - C739AE28284DF28600741E8F /* ViewController.swift */, - C739AE30284DF28600741E8F /* Assets.xcassets */, - C739AE32284DF28600741E8F /* LaunchScreen.storyboard */, + 3BBC988E2A9D683C0047DE81 /* View */, + 3BBC988D2A9D68290047DE81 /* Controller */, + 3BBC988C2A9D67EC0047DE81 /* Resource */, C739AE35284DF28600741E8F /* Info.plist */, C739AE2D284DF28600741E8F /* Diary.xcdatamodeld */, ); @@ -168,6 +195,7 @@ C739AE25284DF28600741E8F /* AppDelegate.swift in Sources */, C739AE27284DF28600741E8F /* SceneDelegate.swift in Sources */, C739AE2F284DF28600741E8F /* Diary.xcdatamodeld in Sources */, + 3BBC98902A9D73D70047DE81 /* DiaryCollectionViewListCell.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Diary/Controller/ViewController.swift b/Diary/Controller/ViewController.swift new file mode 100644 index 000000000..d34140851 --- /dev/null +++ b/Diary/Controller/ViewController.swift @@ -0,0 +1,22 @@ +// +// Diary - ViewController.swift +// Created by yagom. +// Copyright © yagom. All rights reserved. +// + +import UIKit + +final class DiaryListViewController: UIViewController { + private let collectionView: UICollectionView = { + let configuration = UICollectionLayoutListConfiguration(appearance: .plain) + let layout = UICollectionViewCompositionalLayout.list(using: configuration) + let view = UICollectionView(frame: .zero, collectionViewLayout: layout) + view.translatesAutoresizingMaskIntoConstraints = false +// view.register(<#T##cellClass: AnyClass?##AnyClass?#>, forCellWithReuseIdentifier: <#T##String#>) + return view + }() + + override func viewDidLoad() { + super.viewDidLoad() + } +} diff --git a/Diary/AppDelegate.swift b/Diary/Resource/AppDelegate.swift similarity index 100% rename from Diary/AppDelegate.swift rename to Diary/Resource/AppDelegate.swift diff --git a/Diary/Assets.xcassets/AccentColor.colorset/Contents.json b/Diary/Resource/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from Diary/Assets.xcassets/AccentColor.colorset/Contents.json rename to Diary/Resource/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/Diary/Assets.xcassets/AppIcon.appiconset/Contents.json b/Diary/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Diary/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Diary/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Diary/Assets.xcassets/Contents.json b/Diary/Resource/Assets.xcassets/Contents.json similarity index 100% rename from Diary/Assets.xcassets/Contents.json rename to Diary/Resource/Assets.xcassets/Contents.json diff --git a/Diary/SceneDelegate.swift b/Diary/Resource/SceneDelegate.swift similarity index 96% rename from Diary/SceneDelegate.swift rename to Diary/Resource/SceneDelegate.swift index a3ba9636e..6195830bc 100644 --- a/Diary/SceneDelegate.swift +++ b/Diary/Resource/SceneDelegate.swift @@ -13,7 +13,7 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate { func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let windowScene = (scene as? UIWindowScene) else { return } window = UIWindow(windowScene: windowScene) - let mainViewController: ViewController = ViewController() + let mainViewController: UIViewController = DiaryListViewController() let navigationController = UINavigationController(rootViewController: mainViewController) window?.rootViewController = navigationController @@ -50,7 +50,5 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate { // Save changes in the application's managed object context when the application transitions to the background. (UIApplication.shared.delegate as? AppDelegate)?.saveContext() } - - } diff --git a/Diary/Base.lproj/LaunchScreen.storyboard b/Diary/View/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from Diary/Base.lproj/LaunchScreen.storyboard rename to Diary/View/Base.lproj/LaunchScreen.storyboard diff --git a/Diary/View/DiaryCollectionViewListCell.swift b/Diary/View/DiaryCollectionViewListCell.swift new file mode 100644 index 000000000..8269f4916 --- /dev/null +++ b/Diary/View/DiaryCollectionViewListCell.swift @@ -0,0 +1,32 @@ +// +// DiaryCollectionViewCell.swift +// Diary +// +// Created by idinaloq, yetti on 2023/08/29. +// + +import UIKit + +class DiaryCollectionViewListCell: UICollectionViewListCell { + private let titleLabel: UILabel = { + let label = UILabel() + label.text = "타이블레이블" + label.translatesAutoresizingMaskIntoConstraints = false + label.numberOfLines = 1 + return label + }() + private let dateLabel: UILabel = { + let label = UILabel() + label.text = "데이트레이블" + label.translatesAutoresizingMaskIntoConstraints = false + label.numberOfLines = 1 + return label + }() + private let previewLabel: UILabel = { + let label = UILabel() + label.text = "프리뷰레이블" + label.translatesAutoresizingMaskIntoConstraints = false + label.numberOfLines = 1 + return label + }() +} diff --git a/Diary/ViewController.swift b/Diary/ViewController.swift deleted file mode 100644 index 1a116c89d..000000000 --- a/Diary/ViewController.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// Diary - ViewController.swift -// Created by yagom. -// Copyright © yagom. All rights reserved. -// - -import UIKit - -final class ViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - } -}