-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3396a2
commit 3033140
Showing
12 changed files
with
478 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
46
KNU_CSE/KNU_CSE/Main Tab/Board/BoardDetail/BoardDetailModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
Oops, something went wrong.