Skip to content

Commit

Permalink
[Merge] CDS-Mobile1#27 - Pull Develop
Browse files Browse the repository at this point in the history
  • Loading branch information
joonBaek12 committed May 26, 2023
2 parents 30328f5 + f5fd3e9 commit f25bf14
Show file tree
Hide file tree
Showing 6 changed files with 212 additions and 31 deletions.
21 changes: 18 additions & 3 deletions Instagram-iOS/Instagram-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
3EEE76682A176C9100D0B80E /* NewPostImageCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EEE76672A176C9100D0B80E /* NewPostImageCollectionViewCell.swift */; };
3EEE766A2A17A2B900D0B80E /* BackButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EEE76692A17A2B900D0B80E /* BackButton.swift */; };
3EEE766F2A17B5D800D0B80E /* CollectionViewAddCellButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EEE766E2A17B5D800D0B80E /* CollectionViewAddCellButton.swift */; };
7E0148BB2A1890530036147D /* MainFeedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E0148BA2A1890530036147D /* MainFeedViewController.swift */; };
7E0148BE2A1BE8780036147D /* StoryCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E0148BD2A1BE8770036147D /* StoryCollectionView.swift */; };
7E0148C02A1BEA9A0036147D /* StoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E0148BF2A1BEA9A0036147D /* StoryCollectionViewCell.swift */; };
7E8DF56F2A12306B0023948F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8DF56E2A12306B0023948F /* AppDelegate.swift */; };
7E8DF5712A12306B0023948F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8DF5702A12306B0023948F /* SceneDelegate.swift */; };
7E8DF5782A12306E0023948F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7E8DF5772A12306E0023948F /* Assets.xcassets */; };
Expand All @@ -44,7 +47,6 @@
7E8DF5A02A1238840023948F /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8DF59F2A1238840023948F /* Models.swift */; };
7E8DF5AA2A1238C50023948F /* UIComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8DF5A92A1238C50023948F /* UIComponent.swift */; };
7E8DF5AC2A1238D40023948F /* Font.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8DF5AB2A1238D40023948F /* Font.swift */; };
7E8DF5AE2A1238F80023948F /* MainFeed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8DF5AD2A1238F80023948F /* MainFeed.swift */; };
7E8DF5B02A1239010023948F /* Story.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8DF5AF2A1239010023948F /* Story.swift */; };
7E8DF5B42A1239100023948F /* DMList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8DF5B32A1239100023948F /* DMList.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -75,6 +77,9 @@
3EEE76672A176C9100D0B80E /* NewPostImageCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewPostImageCollectionViewCell.swift; sourceTree = "<group>"; };
3EEE76692A17A2B900D0B80E /* BackButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackButton.swift; sourceTree = "<group>"; };
3EEE766E2A17B5D800D0B80E /* CollectionViewAddCellButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewAddCellButton.swift; sourceTree = "<group>"; };
7E0148BA2A1890530036147D /* MainFeedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFeedViewController.swift; sourceTree = "<group>"; };
7E0148BD2A1BE8770036147D /* StoryCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoryCollectionView.swift; sourceTree = "<group>"; };
7E0148BF2A1BEA9A0036147D /* StoryCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoryCollectionViewCell.swift; sourceTree = "<group>"; };
7E8DF56B2A12306B0023948F /* Instagram-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Instagram-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
7E8DF56E2A12306B0023948F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7E8DF5702A12306B0023948F /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -88,7 +93,6 @@
7E8DF59F2A1238840023948F /* Models.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = "<group>"; };
7E8DF5A92A1238C50023948F /* UIComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIComponent.swift; sourceTree = "<group>"; };
7E8DF5AB2A1238D40023948F /* Font.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Font.swift; sourceTree = "<group>"; };
7E8DF5AD2A1238F80023948F /* MainFeed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFeed.swift; sourceTree = "<group>"; };
7E8DF5AF2A1239010023948F /* Story.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Story.swift; sourceTree = "<group>"; };
7E8DF5B32A1239100023948F /* DMList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DMList.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -117,6 +121,15 @@
path = NewPostImageCollection;
sourceTree = "<group>";
};
7E0148BC2A1BE8580036147D /* StoryCollection */ = {
isa = PBXGroup;
children = (
7E0148BD2A1BE8770036147D /* StoryCollectionView.swift */,
7E0148BF2A1BEA9A0036147D /* StoryCollectionViewCell.swift */,
);
path = StoryCollection;
sourceTree = "<group>";
};
7E8DF5622A12306B0023948F = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -284,8 +297,8 @@
7E8DF5912A1236F30023948F /* MainFeed */ = {
isa = PBXGroup;
children = (
7E8DF5AD2A1238F80023948F /* MainFeed.swift */,
7E0148BA2A1890530036147D /* MainFeedViewController.swift */,
7E0148BC2A1BE8580036147D /* StoryCollection */,
);
path = MainFeed;
sourceTree = "<group>";
Expand Down Expand Up @@ -430,9 +443,11 @@
3EEE765F2A1678E800D0B80E /* UserProfileView.swift in Sources */,
3E6CF47A2A14F43500DC3B2B /* BaseViewController.swift in Sources */,
3E9683E42A16319A00D6DD30 /* UIColor+.swift in Sources */,
7E0148C02A1BEA9A0036147D /* StoryCollectionViewCell.swift in Sources */,
3E9683E62A16392900D6DD30 /* ImageLiteral.swift in Sources */,
3EEE76682A176C9100D0B80E /* NewPostImageCollectionViewCell.swift in Sources */,
7E8DF5A02A1238840023948F /* Models.swift in Sources */,
7E0148BE2A1BE8780036147D /* StoryCollectionView.swift in Sources */,
3E6CF47E2A14F84500DC3B2B /* BaseCollectionViewCell.swift in Sources */,
3E9683E82A16456500D6DD30 /* UIFont+.swift in Sources */,
3EEE76632A175ECD00D0B80E /* BottomMenuContentView.swift in Sources */,
Expand Down
Binary file not shown.
8 changes: 0 additions & 8 deletions Instagram-iOS/Instagram-iOS/Screens/MainFeed/MainFeed.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@
//

import UIKit
import SnapKit

class MainFeedViewController: BaseViewController {

// MARK: - Property


// MARK: - UI Property

private let mainCollectionTableView: UITableView = {
let tableView = UITableView()

let storyView = StoryCollectionView()
storyView.frame = .init(x: 0, y: 0, width: SizeLiteral.Screen.width, height: 115)
tableView.tableHeaderView = storyView
return tableView
}()

private let instagramLogoImageView = UIImageView(image: ImageLiteral.NavBar.MainFeed.instagramLogo)

private let dmButton: UIButton = {
Expand All @@ -27,22 +35,20 @@ class MainFeedViewController: BaseViewController {
return button
}()

lazy var rightStackView: UIStackView = {
private lazy var rightStackView: UIStackView = {
let stackView = UIStackView(arrangedSubviews: [dmButton, likeButton])
stackView.distribution = .equalSpacing
stackView.alignment = .fill
stackView.translatesAutoresizingMaskIntoConstraints = false
stackView.axis = .horizontal
stackView.spacing = 30
stackView.spacing = 25
return stackView
}()

// MARK: - Life Cycle

override func viewDidLoad() {
super.viewDidLoad()

setNavigationBar()

}

// MARK: - Setting
Expand All @@ -55,24 +61,39 @@ class MainFeedViewController: BaseViewController {

let dmButton = makeNavigationBarButton(with: dmButton)
let likeButton = makeNavigationBarButton(with: likeButton)
navigationItem.rightBarButtonItems = [
dmButton,
likeButton
]

let rightStackBarButtonItem = UIBarButtonItem(customView: rightStackView)
navigationItem.rightBarButtonItem = rightStackBarButtonItem
}

override func setLayout() {

override func setDelegate() {
mainCollectionTableView.delegate = self
mainCollectionTableView.dataSource = self
}

// MARK: - Action Helper

// MARK: - Custom Method

override func setLayout() {
view.backgroundColor = . black
view.addSubview(mainCollectionTableView)
mainCollectionTableView.snp.makeConstraints {
$0.top.horizontalEdges.equalTo(view.safeAreaLayoutGuide)
$0.horizontalEdges.bottom.equalToSuperview()
}
}
}



// MARK: - UITableView Delegate

extension MainFeedViewController: UITableViewDelegate {}


// MARK: - UITableView DataSource

extension MainFeedViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 4
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return UITableViewCell()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//
// StoryCollectionView.swift
// Instagram-iOS
//
// Created by 김사랑 on 2023/05/23.
//

import Foundation
import UIKit
import SnapKit

final class StoryCollectionView: UIView {

// MARK: - Property

private let dummyData: [UIColor] = [
.systemGray,
.systemGray2,
.systemGray3,
.systemGray4,
.systemGray5,
]

private enum Size {
static let cellWidth = 71
static let cellHeight = 93
}

// MARK: - UI Property

private lazy var storyCollectionView: UICollectionView = {
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectionView.isScrollEnabled = true
collectionView.showsHorizontalScrollIndicator = false
collectionView.showsVerticalScrollIndicator = false
collectionView.register(StoryCollectionViewCell.self, forCellWithReuseIdentifier: StoryCollectionViewCell.identifier)
return collectionView
}()

private let flowLayout: UICollectionViewFlowLayout = {
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
layout.itemSize = .init(width: Size.cellWidth, height: Size.cellHeight)
layout.minimumLineSpacing = 16
return layout
}()

// MARK: - Life Cycle

override init(frame: CGRect) {
super.init(frame: frame)

setDelegate()
setLayout()
}

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

// MARK: - Setting

private func setDelegate() {
storyCollectionView.delegate = self
storyCollectionView.dataSource = self
}

private func setLayout() {
addSubview(storyCollectionView)
storyCollectionView.snp.makeConstraints {
$0.leading.equalToSuperview().inset(8)
$0.trailing.equalToSuperview().inset(0)
$0.top.equalToSuperview().inset(10)
$0.bottom.equalToSuperview().inset(12)
}
}

}


// MARK: - UICollectionView Delegate

extension StoryCollectionView: UICollectionViewDelegate {

}


// MARK: - UICollectionView Datasource

extension StoryCollectionView: UICollectionViewDataSource {

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return dummyData.count
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: StoryCollectionViewCell.identifier, for: indexPath) as? StoryCollectionViewCell
else { return UICollectionViewCell() }
cell.configureCell(with: dummyData[indexPath.row])
return cell
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// StoryCollectionViewCell.swift
// Instagram-iOS
//
// Created by 김사랑 on 2023/05/23.
//

import UIKit
import SnapKit

class StoryCollectionViewCell: BaseCollectionViewCell {

// MARK: - UI Property

private let colorView: UIView = {
let view = UIView()
view.layer.masksToBounds = true
return view
}()

// MARK: - Life Cycle

override init(frame: CGRect) {
super.init(frame: frame)

}

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

// MARK: - Setting

override func setLayout() {
addSubview(colorView)
colorView.snp.makeConstraints {
$0.edges.equalToSuperview()
}
}

// MARK: - Custom Method

func configureCell(with color: UIColor) {
colorView.backgroundColor = color
}


}

0 comments on commit f25bf14

Please sign in to comment.