-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
박스오피스II [STEP 2] BMO, Serena #108
base: ic_9_serena
Are you sure you want to change the base?
Changes from 22 commits
113405e
c849b5f
2258a6c
49aef8a
2f8710c
a4fe9c5
676316c
bab06cd
bc06c9e
3a83403
04cefb4
66aec3a
8c6a7da
5bc3354
c9efcd0
5bcf568
1c25e16
49503c9
a203037
6decb2d
2476fff
04f4e8a
1f14cf0
7023922
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// UserDefaults+.swift | ||
// BoxOffice | ||
// | ||
// Created by Serena, BMO on 2023/08/16. | ||
// | ||
|
||
import Foundation | ||
|
||
extension UserDefaults { | ||
private enum UserDefaultsKeys: String { | ||
case viewMode | ||
} | ||
|
||
var viewMode: String { | ||
get { string(forKey: UserDefaultsKeys.viewMode.rawValue) ?? ViewMode.list.rawValue } | ||
set { setValue(newValue, forKey: UserDefaultsKeys.viewMode.rawValue) } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// ViewMode.swift | ||
// BoxOffice | ||
// | ||
// Created by Serena, BMO on 2023/08/16. | ||
// | ||
|
||
enum ViewMode: String { | ||
case list | ||
case icon | ||
|
||
var anotherOption: String { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. anotherOption이란 네이밍이 조금 어색해보이는데 탄생하게된 배경이 궁금합니다! 🙋🏻 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 7023922 |
||
switch self { | ||
case .list: | ||
return "아이콘" | ||
case .icon: | ||
return "리스트" | ||
} | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// | ||
// BoxOfficeIconCell.swift | ||
// BoxOffice | ||
// | ||
// Created by Serena, BMO on 2023/08/15. | ||
// | ||
|
||
import UIKit | ||
|
||
final class BoxOfficeIconCell: UICollectionViewListCell { | ||
static let identifier = "boxOfficeIconCell" | ||
|
||
// MARK: - InformationStackView | ||
private let contentStackView: UIStackView = { | ||
let stackView = UIStackView() | ||
stackView.translatesAutoresizingMaskIntoConstraints = false | ||
stackView.axis = .vertical | ||
stackView.alignment = .center | ||
stackView.distribution = .fillEqually | ||
|
||
return stackView | ||
}() | ||
|
||
let rankLabel: UILabel = { | ||
let label = UILabel() | ||
label.font = UIFont.preferredFont(forTextStyle: .title1) | ||
label.adjustsFontForContentSizeCategory = true | ||
label.adjustsFontSizeToFitWidth = true | ||
|
||
return label | ||
}() | ||
|
||
let movieNameLabel: UILabel = DetailLabel(fontStyle: .body) | ||
let rankInformationLabel: UILabel = DetailLabel(fontStyle: .body) | ||
let audienceCountLabel: UILabel = DetailLabel(fontStyle: .caption1) | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
configureIconCell() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("not implemnted") | ||
} | ||
} | ||
|
||
// MARK: - Constraints | ||
extension BoxOfficeIconCell { | ||
private func configureIconCell() { | ||
configureUI() | ||
setupConstraints() | ||
} | ||
|
||
private func configureUI() { | ||
addSubview(contentStackView) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
contentStackView.addArrangedSubview(rankLabel) | ||
contentStackView.addArrangedSubview(movieNameLabel) | ||
contentStackView.addArrangedSubview(rankInformationLabel) | ||
contentStackView.addArrangedSubview(audienceCountLabel) | ||
} | ||
|
||
private func setupConstraints() { | ||
setupContentStackViewConstraints() | ||
} | ||
|
||
private func setupContentStackViewConstraints() { | ||
NSLayoutConstraint.activate([ | ||
contentStackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 4), | ||
contentStackView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -4), | ||
contentStackView.topAnchor.constraint(equalTo: topAnchor, constant: 4), | ||
contentStackView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -4) | ||
]) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오... 디테일한 부분까지 신경쓰셨군요 👍