Skip to content

Commit

Permalink
✨[FEAT] 상단 프로필 부분 완성#9
Browse files Browse the repository at this point in the history
  • Loading branch information
SuwonPabby committed Jul 9, 2022
1 parent 9244f0f commit 157a45e
Show file tree
Hide file tree
Showing 11 changed files with 340 additions and 15 deletions.
16 changes: 16 additions & 0 deletions HousLab_iOS/HousLab_iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@

/* Begin PBXBuildFile section */
7713C62B2872F26C00F674BF /* Inject in Frameworks */ = {isa = PBXBuildFile; productRef = 7713C62A2872F26C00F674BF /* Inject */; };
9B8573922877E874005200D1 /* ProfileTopView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B8573912877E874005200D1 /* ProfileTopView.swift */; };
9B875C3B287495270084F660 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B875C3A287495270084F660 /* ProfileViewController.swift */; };
9B875C3D287496840084F660 /* ProfileSubView_Form.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B875C3C287496840084F660 /* ProfileSubView_Form.swift */; };
9BC992C52875D1C000E7E895 /* Preview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BC992C42875D1C000E7E895 /* Preview.swift */; };
9BC992C72875FFA300E7E895 /* ProfileSubCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BC992C62875FFA300E7E895 /* ProfileSubCollectionViewCell.swift */; };
9BD7D895287955B90048ADBE /* ProfileGraphCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BD7D894287955B90048ADBE /* ProfileGraphCollectionViewCell.swift */; };
9BD7D897287957EE0048ADBE /* ProfileBedgeCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BD7D896287957EE0048ADBE /* ProfileBedgeCollectionViewCell.swift */; };
9BD7D89928795FFD0048ADBE /* BasePaddingLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BD7D89828795FFD0048ADBE /* BasePaddingLabel.swift */; };
9BF2CF5D28758E95001AA51C /* EuiJinBaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BF2CF5C28758E95001AA51C /* EuiJinBaseView.swift */; };
B5B5C11D2872E3DB00FC5134 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = B5B5C11C2872E3DB00FC5134 /* SnapKit */; };
B5B5C1202872E43E00FC5134 /* Then in Frameworks */ = {isa = PBXBuildFile; productRef = B5B5C11F2872E43E00FC5134 /* Then */; };
Expand All @@ -27,10 +31,14 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
9B8573912877E874005200D1 /* ProfileTopView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileTopView.swift; sourceTree = "<group>"; };
9B875C3A287495270084F660 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
9B875C3C287496840084F660 /* ProfileSubView_Form.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileSubView_Form.swift; sourceTree = "<group>"; };
9BC992C42875D1C000E7E895 /* Preview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preview.swift; sourceTree = "<group>"; };
9BC992C62875FFA300E7E895 /* ProfileSubCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileSubCollectionViewCell.swift; sourceTree = "<group>"; };
9BD7D894287955B90048ADBE /* ProfileGraphCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileGraphCollectionViewCell.swift; sourceTree = "<group>"; };
9BD7D896287957EE0048ADBE /* ProfileBedgeCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileBedgeCollectionViewCell.swift; sourceTree = "<group>"; };
9BD7D89828795FFD0048ADBE /* BasePaddingLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasePaddingLabel.swift; sourceTree = "<group>"; };
9BF2CF5C28758E95001AA51C /* EuiJinBaseView.swift */ = {isa = PBXFileReference; indentWidth = 2; lastKnownFileType = sourcecode.swift; path = EuiJinBaseView.swift; sourceTree = "<group>"; tabWidth = 2; };
B85302A228728F6300F06234 /* HousLab_iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HousLab_iOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
B85302A528728F6300F06234 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -113,7 +121,11 @@
9BF2CF5C28758E95001AA51C /* EuiJinBaseView.swift */,
9B875C3A287495270084F660 /* ProfileViewController.swift */,
9BC992C62875FFA300E7E895 /* ProfileSubCollectionViewCell.swift */,
9BD7D894287955B90048ADBE /* ProfileGraphCollectionViewCell.swift */,
9BD7D896287957EE0048ADBE /* ProfileBedgeCollectionViewCell.swift */,
9B875C3C287496840084F660 /* ProfileSubView_Form.swift */,
9B8573912877E874005200D1 /* ProfileTopView.swift */,
9BD7D89828795FFD0048ADBE /* BasePaddingLabel.swift */,
);
path = EuiJin;
sourceTree = "<group>";
Expand Down Expand Up @@ -236,11 +248,15 @@
9B875C3B287495270084F660 /* ProfileViewController.swift in Sources */,
B85302C52872A1FF00F06234 /* MinJaeViewController.swift in Sources */,
B85302AA28728F6300F06234 /* ViewController.swift in Sources */,
9BD7D89928795FFD0048ADBE /* BasePaddingLabel.swift in Sources */,
B85302C72872A20600F06234 /* JiHyeonViewController.swift in Sources */,
B85302C12872A1EC00F06234 /* HoseViewController.swift in Sources */,
9BD7D895287955B90048ADBE /* ProfileGraphCollectionViewCell.swift in Sources */,
9BC992C52875D1C000E7E895 /* Preview.swift in Sources */,
B85302A628728F6300F06234 /* AppDelegate.swift in Sources */,
9B875C3D287496840084F660 /* ProfileSubView_Form.swift in Sources */,
9B8573922877E874005200D1 /* ProfileTopView.swift in Sources */,
9BD7D897287957EE0048ADBE /* ProfileBedgeCollectionViewCell.swift in Sources */,
B85302C32872A1F900F06234 /* EuiJinViewController.swift in Sources */,
9BF2CF5D28758E95001AA51C /* EuiJinBaseView.swift in Sources */,
B85302A828728F6300F06234 /* SceneDelegate.swift in Sources */,
Expand Down
29 changes: 29 additions & 0 deletions HousLab_iOS/HousLab_iOS/EuiJin/BasePaddingLabel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// BasePaddingLabel.swift
// HousLab_iOS
//
// Created by 이의진 on 2022/07/09.
//

import UIKit

class BasePaddingLabel: UILabel {
private var padding = UIEdgeInsets(top: 16.0, left: 16.0, bottom: 16.0, right: 16.0)

convenience init(padding: UIEdgeInsets) {
self.init()
self.padding = padding
}

override func drawText(in rect: CGRect) {
super.drawText(in: rect.inset(by: padding))
}

override var intrinsicContentSize: CGSize {
var contentSize = super.intrinsicContentSize
contentSize.height += padding.top + padding.bottom
contentSize.width += padding.left + padding.right

return contentSize
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// ProfileBedgeCollectionViewCell.swift
// HousLab_iOS
//
// Created by 이의진 on 2022/07/09.
//

import UIKit
import SwiftUI

class ProfileBedgeCollectionViewCell: UICollectionViewCell {
static var identifier = "ProfileBedgeCollectionViewCell"


//MARK: - Properties

let tempLabel = UILabel().then{
$0.text = "Temp"
}

//MARK: - Override Methods

override init(frame: CGRect){
super.init(frame: frame)
configureUI()
setConstraints()
}

required init?(coder: NSCoder){
fatalError("init(coder:) has not been implemented")
}

//MARK: - Private Methods

private func configureUI(){
self.backgroundColor = .purple
[tempLabel].forEach {self.addSubview($0)}
}

private func setConstraints(){
tempLabel.snp.makeConstraints{make in
make.top.equalTo(self.safeAreaLayoutGuide)
make.centerY.equalToSuperview()
}
}


}

struct VCPreView4:PreviewProvider {
static var previews: some View {
ProfileViewController().toPreview()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// DemoCell.swift
// HousLab_iOS
//
// Created by 이의진 on 2022/07/07.
//

import UIKit
import SwiftUI

class ProfileGraphbCollectionViewCell: UICollectionViewCell {

static var identifier = "ProfileGraphCollectionViewCell"


//MARK: - Properties

let tempLabel = UILabel().then{
$0.text = "Temp"
}

//MARK: - Override Methods

override init(frame: CGRect){
super.init(frame: frame)
configureUI()
setConstraints()
}

required init?(coder: NSCoder){
fatalError("init(coder:) has not been implemented")
}

//MARK: - Private Methods

private func configureUI(){
self.backgroundColor = .blue
[tempLabel].forEach {self.addSubview($0)}
}

private func setConstraints(){
tempLabel.snp.makeConstraints{make in
make.top.equalTo(self.safeAreaLayoutGuide)
make.centerY.equalToSuperview()
}
}


}

struct VCPreView3:PreviewProvider {
static var previews: some View {
ProfileViewController().toPreview()
}
}
71 changes: 63 additions & 8 deletions HousLab_iOS/HousLab_iOS/EuiJin/ProfileSubCollectionViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import UIKit
import SwiftUI

class ProfileSubCollectionViewCell: UICollectionViewCell {

Expand All @@ -14,8 +15,43 @@ class ProfileSubCollectionViewCell: UICollectionViewCell {

//MARK: - Properties

let tempLabel = UILabel().then{
$0.text = "Temp"
var profileImage = UIImageView().then {
$0.image = UIImage(named: "Group 6995")
}

private lazy var profileGuideStackView = UIStackView().then{
$0.alignment = .leading
$0.distribution = .fillProportionally
$0.axis = .vertical
$0.spacing = 4

}

var userName = UILabel().then{
$0.text = "최인영"
$0.textColor = .black
$0.font = .boldSystemFont(ofSize: 26)
}

var userJob = UILabel().then{
$0.text = "대학생"
$0.textColor = .red
$0.font = .systemFont(ofSize: 13)
}

var statusMessage = UILabel().then{
$0.text = "낮에 자고 밤에 일하는 부엉이"
$0.textColor = .gray
$0.font = .systemFont(ofSize: 15)
}

var tag1 = BasePaddingLabel(padding: UIEdgeInsets(top: 5, left: 10, bottom: 5, right: 10)).then{
$0.text = "부엉이"
$0.textColor = .white
$0.font = .systemFont(ofSize: 13)
$0.backgroundColor = .purple
$0.layer.cornerRadius = 10
$0.layer.masksToBounds = true
}

//MARK: - Override Methods
Expand All @@ -33,16 +69,35 @@ class ProfileSubCollectionViewCell: UICollectionViewCell {
//MARK: - Private Methods

private func configureUI(){
self.backgroundColor = .green
[tempLabel].forEach {self.addSubview($0)}
self.backgroundColor = .white
[profileImage, userName, userJob, profileGuideStackView].forEach {self.addSubview($0)}
[userName, statusMessage, tag1].forEach {profileGuideStackView.addArrangedSubview($0)}
}

private func setConstraints(){
tempLabel.snp.makeConstraints{make in
make.top.equalTo(self.safeAreaLayoutGuide)
profileImage.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.leading.equalToSuperview().offset(20)

}

profileGuideStackView.snp.makeConstraints { make in
make.bottom.equalTo(profileImage.snp.bottom)
make.leading.equalTo(profileImage.snp.trailing).offset(24)
}

userJob.snp.makeConstraints {make in
make.centerY.equalTo(userName.snp.centerY).offset(3)
make.leading.equalTo(userName.snp.trailing).offset(8)

}
}



}

struct VCPreView2:PreviewProvider {
static var previews: some View {
ProfileViewController().toPreview()
}
}

73 changes: 73 additions & 0 deletions HousLab_iOS/HousLab_iOS/EuiJin/ProfileTopView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//
// ProfileTopView.swift
// HousLab_iOS
//
// Created by 이의진 on 2022/07/08.
//

import UIKit
import SwiftUI

class ProfileTopView: EuiJinBaseView {

//MARK: - Properties

var appNameLabel = UILabel().then{
$0.text = "Hous - ME"
$0.textColor = .black
$0.font = UIFont.boldSystemFont(ofSize: 26)
}

var editProfileButton = UIButton().then{
$0.setImage(UIImage(named: "edit"), for: .normal)
}

var settingProfileButton = UIButton().then{
$0.setImage(UIImage(named: "edit"), for: .normal)
}

override func setUp(){

}

override func configureUI() {
self.backgroundColor = .white
[appNameLabel,editProfileButton, settingProfileButton].forEach {self.addSubview($0)}
}

override func setConstraints() {
appNameLabel.snp.makeConstraints { make in
make.leading.equalToSuperview().offset(24)
make.centerY.equalToSuperview()
}

editProfileButton.snp.makeConstraints {make in
make.trailing.equalToSuperview().offset(-60)
make.centerY.equalToSuperview()
make.width.height.equalTo(24)
}

settingProfileButton.snp.makeConstraints {make in
make.trailing.equalToSuperview().offset(-24)
make.centerY.equalToSuperview()
make.width.height.equalTo(24)
}
}



}

struct VCPreView1:PreviewProvider {
static var previews: some View {
ProfileViewController().toPreview()
}
}

//
//}





Loading

0 comments on commit 157a45e

Please sign in to comment.