Skip to content

Commit

Permalink
[Feat] TeamSparker#122 - 진행중 리스트 서버 연결 완료
Browse files Browse the repository at this point in the history
진행중 리스트 서버 연결 완료
  • Loading branch information
L-j-h-c committed Jan 19, 2022
1 parent 1161d52 commit ef7e6bd
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
17 changes: 17 additions & 0 deletions Spark-iOS/Spark-iOS/Source/Cells/Storage/DoingStorageCVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class DoingStorageCVC: UICollectionViewCell {
@IBOutlet weak var cardBorderImageView: UIImageView!
@IBOutlet weak var dDayLabel: UILabel!
@IBOutlet weak var flakeImage: UIImageView!
@IBOutlet weak var roomNameLabel: UILabel!
@IBOutlet weak var sparkCountLabel: UILabel!
@IBOutlet weak var dateLabel: UILabel!
@IBOutlet weak var thumbnailImage: UIImageView!

override func awakeFromNib() {
super.awakeFromNib()
Expand All @@ -21,6 +25,7 @@ class DoingStorageCVC: UICollectionViewCell {

func setUI() {
gradationUIView.setGradient(color1: UIColor.clear, color2: UIColor.black)
flakeImage.contentMode = .scaleAspectFit
}

func initCell(roomName: String,
Expand All @@ -31,10 +36,22 @@ class DoingStorageCVC: UICollectionViewCell {
endDate: String) {
let sparkFlake: SparkFlake = SparkFlake(leftDay: leftDay)

flakeImage.image = sparkFlake.sparkFlakeGoingStorage()

sparkCountLabel.text = String(sparkCount)

roomNameLabel.text = roomName

let startDate = startDate.split(separator: "-")
let endDate = endDate.split(separator: "-")
dateLabel.text = "\(startDate[0]).\(startDate[1]).\(startDate[2]) - \(endDate[0]).\(endDate[1]).\(endDate[2])"

if leftDay == 0 {
dDayLabel.text = "D-day"
} else {
dDayLabel.text = "D-\(leftDay)"
}

thumbnailImage.updateImage(thumbnail)
}
}
6 changes: 5 additions & 1 deletion Spark-iOS/Spark-iOS/Source/Cells/Storage/DoingStorageCVC.xib
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<rect key="frame" x="0.0" y="0.0" width="327" height="193"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2021.12.26 - 2022.02.26" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UHD-ha-kvM">
<rect key="frame" x="84.333333333333329" y="216" width="158.66666666666669" height="18"/>
<rect key="frame" x="82" y="216" width="163" height="18.333333333333343"/>
<fontDescription key="fontDescription" name="Futura" family="Futura" pointSize="14"/>
<color key="textColor" name="sparkGray"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -136,8 +136,12 @@
<connections>
<outlet property="cardBorderImageView" destination="m5x-6b-Xxs" id="nUh-7g-j6R"/>
<outlet property="dDayLabel" destination="GHk-jj-mc1" id="Aco-dQ-Qku"/>
<outlet property="dateLabel" destination="UHD-ha-kvM" id="OTs-Im-L94"/>
<outlet property="flakeImage" destination="MHT-q9-d5W" id="ucz-hu-Twl"/>
<outlet property="gradationUIView" destination="CnH-6S-xaz" id="Vcb-n3-fS1"/>
<outlet property="roomNameLabel" destination="R1V-eF-ogN" id="SDz-wS-Kz5"/>
<outlet property="sparkCountLabel" destination="RAD-hP-JYn" id="gJg-Dw-1Ab"/>
<outlet property="thumbnailImage" destination="NC1-RV-FLH" id="jp2-mB-OFu"/>
</connections>
<point key="canvasLocation" x="151.19999999999999" y="152.95566502463055"/>
</collectionViewCell>
Expand Down
18 changes: 16 additions & 2 deletions Spark-iOS/Spark-iOS/Source/ViewControllers/TabBar/StorageVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class StorageVC: UIViewController {

// 사이즈 임의설정
private var myRoomCountSize: Int = 30
private var isInfiniteScroll: Bool = true
private var isInfiniteScroll: Bool = false

let doingButton = StatusButton()
let doneButton = StatusButton()
Expand Down Expand Up @@ -387,16 +387,30 @@ extension StorageVC: UICollectionViewDelegate, UICollectionViewDataSource {
}

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 20
switch collectionView {
case DoingCV:
return onGoingRoomList?.count ?? 0
case DoneCV:
return onGoingRoomList?.count ?? 0
case FailCV:
return onGoingRoomList?.count ?? 0
default:
return 0
}
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {

switch collectionView {
case DoingCV:
guard let onGoingRoomList = onGoingRoomList else { return UICollectionViewCell()}

guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: Const.Xib.NibName.doingStorageCVC, for: indexPath) as? DoingStorageCVC else { return UICollectionViewCell() }

cell.initCell(roomName: onGoingRoomList[indexPath.row].roomName, leftDay: onGoingRoomList[indexPath.row].leftDay , thumbnail: onGoingRoomList[indexPath.row].thumbnail , sparkCount: onGoingRoomList[indexPath.row].totalReceivedSpark, startDate: onGoingRoomList[indexPath.row].startDate, endDate: onGoingRoomList[indexPath.row].endDate)

return cell

case DoneCV:
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: Const.Xib.NibName.doneStorageCVC, for: indexPath) as? DoneStorageCVC else { return UICollectionViewCell()}

Expand Down

0 comments on commit ef7e6bd

Please sign in to comment.