Skip to content

Commit

Permalink
Merge pull request #4 from SWU-ECHO-CHAMBER/feat/#1-HomeTab
Browse files Browse the repository at this point in the history
Feat/#1 home tab
  • Loading branch information
AlwaysFighting authored Jul 20, 2023
2 parents fdeb63b + 754dd42 commit 4f1d901
Show file tree
Hide file tree
Showing 11 changed files with 630 additions and 56 deletions.
39 changes: 36 additions & 3 deletions EchoChamber/EchoChamber.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
510D86952A6853AA008DCF16 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 510D86942A6853AA008DCF16 /* HomeViewController.swift */; };
510D869A2A68551B008DCF16 /* TabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 510D86992A68551B008DCF16 /* TabBarController.swift */; };
510D869E2A685689008DCF16 /* MyPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 510D869D2A685689008DCF16 /* MyPageViewController.swift */; };
512845A42A69090800BD02EE /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = 512845A32A69090800BD02EE /* Kingfisher */; };
512845A62A692EDE00BD02EE /* TodayNewsCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512845A52A692EDE00BD02EE /* TodayNewsCollectionViewCell.swift */; };
512845AA2A6961D600BD02EE /* HomeCollectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512845A92A6961D600BD02EE /* HomeCollectionHeaderView.swift */; };
512845AC2A6962EC00BD02EE /* Inset+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512845AB2A6962EC00BD02EE /* Inset+.swift */; };
512845B02A69961700BD02EE /* DetailNewsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512845AF2A69961700BD02EE /* DetailNewsViewController.swift */; };
51B535DF2A542EC500FB64BE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51B535DE2A542EC500FB64BE /* AppDelegate.swift */; };
51B535E12A542EC500FB64BE /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51B535E02A542EC500FB64BE /* SceneDelegate.swift */; };
51B535E82A542EC500FB64BE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 51B535E72A542EC500FB64BE /* Assets.xcassets */; };
Expand All @@ -28,6 +33,10 @@
510D86942A6853AA008DCF16 /* HomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = "<group>"; };
510D86992A68551B008DCF16 /* TabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarController.swift; sourceTree = "<group>"; };
510D869D2A685689008DCF16 /* MyPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageViewController.swift; sourceTree = "<group>"; };
512845A52A692EDE00BD02EE /* TodayNewsCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayNewsCollectionViewCell.swift; sourceTree = "<group>"; };
512845A92A6961D600BD02EE /* HomeCollectionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeCollectionHeaderView.swift; sourceTree = "<group>"; };
512845AB2A6962EC00BD02EE /* Inset+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Inset+.swift"; sourceTree = "<group>"; };
512845AF2A69961700BD02EE /* DetailNewsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailNewsViewController.swift; sourceTree = "<group>"; };
51B535DB2A542EC500FB64BE /* EchoChamber.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EchoChamber.app; sourceTree = BUILT_PRODUCTS_DIR; };
51B535DE2A542EC500FB64BE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
51B535E02A542EC500FB64BE /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -41,6 +50,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
512845A42A69090800BD02EE /* Kingfisher in Frameworks */,
510D868C2A67D935008DCF16 /* SnapKit in Frameworks */,
510D868F2A67D941008DCF16 /* Alamofire in Frameworks */,
);
Expand Down Expand Up @@ -73,6 +83,7 @@
isa = PBXGroup;
children = (
510D86912A680A56008DCF16 /* Color+.swift */,
512845AB2A6962EC00BD02EE /* Inset+.swift */,
);
path = Extension;
sourceTree = "<group>";
Expand All @@ -88,22 +99,25 @@
isa = PBXGroup;
children = (
510D86982A685440008DCF16 /* Model */,
510D86972A68542F008DCF16 /* Controller */,
510D86972A68542F008DCF16 /* View */,
);
path = Home;
sourceTree = "<group>";
};
510D86972A68542F008DCF16 /* Controller */ = {
510D86972A68542F008DCF16 /* View */ = {
isa = PBXGroup;
children = (
510D86942A6853AA008DCF16 /* HomeViewController.swift */,
512845A92A6961D600BD02EE /* HomeCollectionHeaderView.swift */,
512845AF2A69961700BD02EE /* DetailNewsViewController.swift */,
);
path = Controller;
path = View;
sourceTree = "<group>";
};
510D86982A685440008DCF16 /* Model */ = {
isa = PBXGroup;
children = (
512845A52A692EDE00BD02EE /* TodayNewsCollectionViewCell.swift */,
);
path = Model;
sourceTree = "<group>";
Expand Down Expand Up @@ -174,6 +188,7 @@
packageProductDependencies = (
510D868B2A67D935008DCF16 /* SnapKit */,
510D868E2A67D941008DCF16 /* Alamofire */,
512845A32A69090800BD02EE /* Kingfisher */,
);
productName = EchoChamber;
productReference = 51B535DB2A542EC500FB64BE /* EchoChamber.app */;
Expand Down Expand Up @@ -206,6 +221,7 @@
packageReferences = (
510D868A2A67D935008DCF16 /* XCRemoteSwiftPackageReference "SnapKit" */,
510D868D2A67D941008DCF16 /* XCRemoteSwiftPackageReference "Alamofire" */,
512845A22A69090800BD02EE /* XCRemoteSwiftPackageReference "Kingfisher" */,
);
productRefGroup = 51B535DC2A542EC500FB64BE /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -236,10 +252,14 @@
510D86892A67D3E6008DCF16 /* LoginViewcontroller.swift in Sources */,
510D86922A680A56008DCF16 /* Color+.swift in Sources */,
510D869A2A68551B008DCF16 /* TabBarController.swift in Sources */,
512845AA2A6961D600BD02EE /* HomeCollectionHeaderView.swift in Sources */,
512845B02A69961700BD02EE /* DetailNewsViewController.swift in Sources */,
51B535DF2A542EC500FB64BE /* AppDelegate.swift in Sources */,
51B535E12A542EC500FB64BE /* SceneDelegate.swift in Sources */,
512845A62A692EDE00BD02EE /* TodayNewsCollectionViewCell.swift in Sources */,
510D86862A67D3C1008DCF16 /* LaunchViewController.swift in Sources */,
510D86952A6853AA008DCF16 /* HomeViewController.swift in Sources */,
512845AC2A6962EC00BD02EE /* Inset+.swift in Sources */,
510D869E2A685689008DCF16 /* MyPageViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -466,6 +486,14 @@
minimumVersion = 5.0.0;
};
};
512845A22A69090800BD02EE /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/onevcat/Kingfisher";
requirement = {
branch = master;
kind = branch;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand All @@ -479,6 +507,11 @@
package = 510D868D2A67D941008DCF16 /* XCRemoteSwiftPackageReference "Alamofire" */;
productName = Alamofire;
};
512845A32A69090800BD02EE /* Kingfisher */ = {
isa = XCSwiftPackageProductDependency;
package = 512845A22A69090800BD02EE /* XCRemoteSwiftPackageReference "Kingfisher" */;
productName = Kingfisher;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 51B535D32A542EC500FB64BE /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
"version" : "5.7.1"
}
},
{
"identity" : "kingfisher",
"kind" : "remoteSourceControl",
"location" : "https://github.com/onevcat/Kingfisher",
"state" : {
"branch" : "master",
"revision" : "40d7062bd9e6645f3bd5430e18565286f1223712"
}
},
{
"identity" : "snapkit",
"kind" : "remoteSourceControl",
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>EchoChamber.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
<key>SnapKitPlayground (Playground) 1.xcscheme</key>
<dict>
Expand Down
1 change: 1 addition & 0 deletions EchoChamber/EchoChamber/Extension/Color+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ extension UIColor {
static var mainColor = #colorLiteral(red: 0.1450980392, green: 0.3450980392, blue: 0.6705882353, alpha: 1)

static var textColor = #colorLiteral(red: 0.1071854457, green: 0.1071854457, blue: 0.1071854457, alpha: 1)
static var titleTextColor = #colorLiteral(red: 0.3014189303, green: 0.3014189005, blue: 0.3014189303, alpha: 1)
static var subTextColor = #colorLiteral(red: 0.834138453, green: 0.8341383338, blue: 0.834138453, alpha: 1)

static var systemGrayColor = #colorLiteral(red: 0.5369143486, green: 0.5369143486, blue: 0.5369143486, alpha: 1)
Expand Down
12 changes: 12 additions & 0 deletions EchoChamber/EchoChamber/Extension/Inset+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// Inset+.swift
// EchoChamber
//
// Created by 목정아 on 2023/07/20.
//

import Foundation

struct Inset {
static var inset : CGFloat = 16.0
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
//
// TodayNewsCollectionViewCell.swift
// EchoChamber
//
// Created by 목정아 on 2023/07/20.
//

import UIKit
import SnapKit
import Kingfisher



class TodayNewsCollectionViewCell : UICollectionViewCell {

static let identifier = "TodayNewsCollectionViewCell"
let inset: CGFloat = Inset.inset

private let newsImageView: UIImageView = {
let imageView = UIImageView()

imageView.contentMode = .scaleAspectFill
imageView.layer.cornerRadius = 18.0
imageView.layer.masksToBounds = true

if let imageURL = URL(string: "https://media.cnn.com/api/v1/images/stellar/prod/230714140155-02-carlethia-nichole-russell.jpg?c=16x9&q=w_800,c_fill") {
imageView.kf.setImage(with: imageURL)
}

return imageView
}()


private lazy var newsTitle: UILabel = {
let label = UILabel()
label.text = "Police share new details about the disappearance of Carlee Russell, the woman who went missing in Alabama after calling 911 about a child on an interstate"
label.textColor = .titleTextColor
label.font = .systemFont(ofSize: 15.0, weight: .semibold)

label.numberOfLines = 3
return label
}()

private lazy var newsDescription: UILabel = {
let label = UILabel()
label.text = "By Brad Lendon, CNN"
label.textColor = .subTextColor
label.font = .systemFont(ofSize: 12.0, weight: .regular)
label.numberOfLines = 1

return label
}()

private lazy var recommendationView : UIView = {
let view = UIView()

view.backgroundColor = .mainColor
view.translatesAutoresizingMaskIntoConstraints = false
view.heightAnchor.constraint(equalToConstant: 8.0).isActive = true
view.widthAnchor.constraint(equalToConstant: 8.0).isActive = true

return view
}()

private lazy var recommentLabel : UILabel = {
let label = UILabel()
label.text = "the reson of recommendation"
label.font = .systemFont(ofSize: 12.0, weight: .regular)
label.textColor = .systemGrayColor

return label
}()

private lazy var recomendationStackView : UIStackView = {
let stackView = UIStackView()
stackView.axis = .horizontal
stackView.distribution = .fillProportionally
stackView.spacing = 5.0

[
recommendationView,
recommentLabel
].forEach { stackView.addArrangedSubview($0) }

return stackView
}()

func setup() {
// backgroundColor = .white
self.setupLayout()
}

}

private extension TodayNewsCollectionViewCell {
func setupLayout() {
[
newsImageView,
recomendationStackView,
newsTitle,
newsDescription
].forEach { addSubview($0) }

newsImageView.snp.makeConstraints {
$0.leading.equalToSuperview()
$0.height.width.equalTo(104.0)
}

recomendationStackView.snp.makeConstraints {
$0.top.equalTo(newsImageView.snp.top)
$0.trailing.equalToSuperview()
$0.width.equalTo(202.0)
$0.leading.equalTo(newsImageView.snp.trailing).offset(inset)
}

newsTitle.snp.makeConstraints {
$0.top.equalTo(recomendationStackView.snp.bottom).offset(8.0)
$0.leading.equalTo(recomendationStackView.snp.leading)
$0.trailing.lessThanOrEqualToSuperview().inset(10.0)
}

newsDescription.snp.makeConstraints {
$0.top.equalTo(newsTitle.snp.bottom).offset(5.0)
$0.leading.equalTo(recomendationStackView.snp.leading)
$0.bottom.equalTo(newsImageView.snp.bottom)
}
}
}
Loading

0 comments on commit 4f1d901

Please sign in to comment.