Skip to content

Commit

Permalink
#3 add BoardDetailView
Browse files Browse the repository at this point in the history
  • Loading branch information
JunseokNoh committed Jul 22, 2021
1 parent d3396a2 commit 3033140
Show file tree
Hide file tree
Showing 12 changed files with 478 additions and 11 deletions.
36 changes: 36 additions & 0 deletions KNU_CSE/KNU_CSE.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
681D37F426A737AE000D9FE8 /* SignInNavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 681D37F326A737AE000D9FE8 /* SignInNavigationView.swift */; };
681D37F726A73D3E000D9FE8 /* BoardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 681D37F626A73D3E000D9FE8 /* BoardView.swift */; };
681D37F926A73F71000D9FE8 /* BoardTitleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 681D37F826A73F70000D9FE8 /* BoardTitleCell.swift */; };
681D37FD26A99454000D9FE8 /* BoardDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 681D37FC26A99454000D9FE8 /* BoardDetailView.swift */; };
681D380926A9C5BE000D9FE8 /* BoardDetailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 681D380826A9C5BE000D9FE8 /* BoardDetailModel.swift */; };
681D380B26A9C642000D9FE8 /* BoardDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 681D380A26A9C642000D9FE8 /* BoardDetailViewModel.swift */; };
681D380D26A9CDA1000D9FE8 /* BoardDataDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 681D380C26A9CDA1000D9FE8 /* BoardDataDelegate.swift */; };
681D380F26A9FC51000D9FE8 /* CommentTableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 681D380E26A9FC51000D9FE8 /* CommentTableCell.swift */; };
68F1A5B826A0088B007B4B86 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5B726A0088B007B4B86 /* AppDelegate.swift */; };
68F1A5BA26A0088B007B4B86 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5B926A0088B007B4B86 /* SceneDelegate.swift */; };
68F1A5BC26A0088B007B4B86 /* SignInView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5BB26A0088B007B4B86 /* SignInView.swift */; };
Expand Down Expand Up @@ -117,6 +122,11 @@
681D37F326A737AE000D9FE8 /* SignInNavigationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInNavigationView.swift; sourceTree = "<group>"; };
681D37F626A73D3E000D9FE8 /* BoardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoardView.swift; sourceTree = "<group>"; };
681D37F826A73F70000D9FE8 /* BoardTitleCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoardTitleCell.swift; sourceTree = "<group>"; };
681D37FC26A99454000D9FE8 /* BoardDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoardDetailView.swift; sourceTree = "<group>"; };
681D380826A9C5BE000D9FE8 /* BoardDetailModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoardDetailModel.swift; sourceTree = "<group>"; };
681D380A26A9C642000D9FE8 /* BoardDetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoardDetailViewModel.swift; sourceTree = "<group>"; };
681D380C26A9CDA1000D9FE8 /* BoardDataDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoardDataDelegate.swift; sourceTree = "<group>"; };
681D380E26A9FC51000D9FE8 /* CommentTableCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentTableCell.swift; sourceTree = "<group>"; };
68F1A5B426A0088B007B4B86 /* KNU_CSE.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KNU_CSE.app; sourceTree = BUILT_PRODUCTS_DIR; };
68F1A5B726A0088B007B4B86 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
68F1A5B926A0088B007B4B86 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -198,7 +208,9 @@
isa = PBXGroup;
children = (
681D37F626A73D3E000D9FE8 /* BoardView.swift */,
681D37FB26A99406000D9FE8 /* BoardDetail */,
681D37F526A73CC8000D9FE8 /* FreeBoard */,
681D37FA26A8BB92000D9FE8 /* NoticeBoard */,
);
path = Board;
sourceTree = "<group>";
Expand All @@ -221,6 +233,7 @@
681D37DC26A5BF2D000D9FE8 /* ClassSeatCell.swift */,
681D37EB26A6CD87000D9FE8 /* ReservationCheckCell.swift */,
681D37F826A73F70000D9FE8 /* BoardTitleCell.swift */,
681D380E26A9FC51000D9FE8 /* CommentTableCell.swift */,
);
path = Cell;
sourceTree = "<group>";
Expand Down Expand Up @@ -253,6 +266,7 @@
681D37D826A4A75F000D9FE8 /* ClassDataDelegate.swift */,
681D37E426A6AD36000D9FE8 /* ViewProtocol.swift */,
681D37F126A70FE2000D9FE8 /* ReservationCheckDelegate.swift */,
681D380C26A9CDA1000D9FE8 /* BoardDataDelegate.swift */,
);
path = Delegate;
sourceTree = "<group>";
Expand All @@ -277,6 +291,23 @@
path = FreeBoard;
sourceTree = "<group>";
};
681D37FA26A8BB92000D9FE8 /* NoticeBoard */ = {
isa = PBXGroup;
children = (
);
path = NoticeBoard;
sourceTree = "<group>";
};
681D37FB26A99406000D9FE8 /* BoardDetail */ = {
isa = PBXGroup;
children = (
681D37FC26A99454000D9FE8 /* BoardDetailView.swift */,
681D380A26A9C642000D9FE8 /* BoardDetailViewModel.swift */,
681D380826A9C5BE000D9FE8 /* BoardDetailModel.swift */,
);
path = BoardDetail;
sourceTree = "<group>";
};
68D5448F26A40E220072C2A4 /* KNU Notice */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -729,6 +760,7 @@
681D37D926A4A75F000D9FE8 /* ClassDataDelegate.swift in Sources */,
68F1A60F26A30D07007B4B86 /* Alert.swift in Sources */,
681D37BB26A4279F000D9FE8 /* FreeBoardView.swift in Sources */,
681D380D26A9CDA1000D9FE8 /* BoardDataDelegate.swift in Sources */,
681D37D526A48A6F000D9FE8 /* MyPageModel.swift in Sources */,
681D37CA26A467CA000D9FE8 /* ReservationView.swift in Sources */,
68F1A5F826A0090B007B4B86 /* SignUpViewModel.swift in Sources */,
Expand All @@ -743,13 +775,16 @@
681D37C426A45442000D9FE8 /* ClassRoomCell.swift in Sources */,
68F1A61226A3120D007B4B86 /* TabView.swift in Sources */,
68F1A5BA26A0088B007B4B86 /* SceneDelegate.swift in Sources */,
681D380F26A9FC51000D9FE8 /* CommentTableCell.swift in Sources */,
68F1A5F626A0090B007B4B86 /* SignUpModel.swift in Sources */,
68F1A60326A0A73B007B4B86 /* Color.swift in Sources */,
681D37EC26A6CD87000D9FE8 /* ReservationCheckCell.swift in Sources */,
681D37DF26A5DABC000D9FE8 /* ReservationModel.swift in Sources */,
68F1A5FC26A01080007B4B86 /* SignInViewModel.swift in Sources */,
68F1A5F926A0090B007B4B86 /* BindingTextField.swift in Sources */,
681D37FD26A99454000D9FE8 /* BoardDetailView.swift in Sources */,
681D37B526A419F3000D9FE8 /* MyPageView.swift in Sources */,
681D380926A9C5BE000D9FE8 /* BoardDetailModel.swift in Sources */,
681D37DB26A4AAAC000D9FE8 /* ReservationViewModel.swift in Sources */,
68F1A60026A07FE7007B4B86 /* CheckBox.swift in Sources */,
68F1A5EC26A008FF007B4B86 /* Request.swift in Sources */,
Expand All @@ -765,6 +800,7 @@
681D37F726A73D3E000D9FE8 /* BoardView.swift in Sources */,
681D37EE26A70493000D9FE8 /* ReservationCheckViewModel.swift in Sources */,
681D37D326A48A64000D9FE8 /* MyPageViewModel.swift in Sources */,
681D380B26A9C642000D9FE8 /* BoardDetailViewModel.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
15 changes: 15 additions & 0 deletions KNU_CSE/KNU_CSE/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,21 @@
</objects>
<point key="canvasLocation" x="2959" y="1675"/>
</scene>
<!--Board Detail View-->
<scene sceneID="mpH-79-wlz">
<objects>
<viewController storyboardIdentifier="BoardDetailView" useStoryboardIdentifierAsRestorationIdentifier="YES" id="rVm-mo-wxw" customClass="BoardDetailView" customModule="KNU_CSE" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="5dq-Ui-Uqz">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="8Oe-VS-v3G"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="O7N-kK-yKA" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3920" y="1687"/>
</scene>
</scenes>
<resources>
<image name="arrow.up.bin.fill" catalog="system" width="128" height="93"/>
Expand Down
84 changes: 84 additions & 0 deletions KNU_CSE/KNU_CSE/Custom/Cell/CommentTableCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
//
// CommentTableCell.swift
// KNU_CSE
//
// Created by junseok on 2021/07/23.
//

import UIKit

class CommentTableCell : UITableViewCell {
static let identifier = "CommentTableCell"
var titleView = UIView()

var titleLabel:UILabel!{
didSet{
titleLabel.font = UIFont.systemFont(ofSize: 13, weight: .light)
titleLabel.textAlignment = .right
}
}

var contentLabel:UILabel!{
didSet{
contentLabel.font = UIFont.systemFont(ofSize: 13, weight: .semibold)
contentLabel.textAlignment = .left
}
}

var action :()->() = {}

var comment:Comment!{
didSet{
titleLabel.text = comment.author
contentLabel.text = comment.content

self.setUpConstraints()
}
}

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.initUI()
self.addView()

}

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

func initUI(){
self.titleLabel = UILabel()
self.contentLabel = UILabel()
}

func addView(){
self.contentView.addSubview(titleView)
self.contentView.addSubview(contentLabel)

self.titleView.addSubview(titleLabel)
}

func setUpConstraints(){
titleView.snp.makeConstraints{ make in
make.left.equalToSuperview()
make.top.equalToSuperview()
make.bottom.equalToSuperview()
make.width.equalToSuperview().multipliedBy(0.3)
}

titleLabel.snp.makeConstraints{ make in
make.left.equalToSuperview()
make.top.equalToSuperview()
make.bottom.equalToSuperview()
make.right.equalToSuperview().offset(-20)
}

contentLabel.snp.makeConstraints{ make in
make.left.equalTo(titleView.snp.right).offset(0)
make.top.equalToSuperview()
make.bottom.equalToSuperview()
make.right.equalToSuperview().offset(0)
}
}
}
12 changes: 6 additions & 6 deletions KNU_CSE/KNU_CSE/Custom/Cell/FreeBoardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ class FreeBoardCell : UITableViewCell {
var action :()->() = {}
var cellBtn = UIButton()

var viewModel : Board!{
var board : Board!{
didSet{
self.setAuthorText(title: viewModel.author)
self.setDateText(title: viewModel.date)
self.setTitleText(title: viewModel.title)
self.setContentText(title: viewModel.content)
self.setCommentText(title: String(viewModel.numberOfcomment))
self.setAuthorText(title: board.author)
self.setDateText(title: board.date)
self.setTitleText(title: board.title)
self.setContentText(title: board.content)
self.setCommentText(title: String(board.numberOfcomment))
}
}

Expand Down
12 changes: 12 additions & 0 deletions KNU_CSE/KNU_CSE/Custom/Delegate/BoardDataDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// BoardDataDelegate.swift
// KNU_CSE
//
// Created by junseok on 2021/07/23.
//

import Foundation

protocol BoardDataDelegate{
func sendBoard(board:Board)
}
46 changes: 46 additions & 0 deletions KNU_CSE/KNU_CSE/Main Tab/Board/BoardDetail/BoardDetailModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// BoardDetailModel.swift
// KNU_CSE
//
// Created by junseok on 2021/07/23.
//

import Foundation

class Comment:BaseObject{
var commentId:Int!
var content:String!
var date:String!
var author:String!
var replyList:[Reply]!

init(commentId:Int, content:String, date:String, author:String) {
self.commentId = commentId
self.content = content
self.date = date
self.author = author
super.init()
}

required init(from decoder: Decoder) throws {
fatalError("init(from:) has not been implemented")
}

func setReplyList(replyList:[Reply]){
self.replyList = replyList
}
}

struct Reply:Codable{
var replyId:Int!
var content:String!
var date:String!
var author:String!

init(replyId:Int, content:String, date:String, author:String) {
self.replyId = replyId
self.content = content
self.date = date
self.author = author
}
}
Loading

0 comments on commit 3033140

Please sign in to comment.