generated from GSM-MSG/MSG-Repository-Generator
-
Notifications
You must be signed in to change notification settings - Fork 0
홈페이지 UI 추가 #15
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
Merged
Merged
홈페이지 UI 추가 #15
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
86524d4
:lipstick: :: HomeView publishing
uuuunseo 20f05e6
:lipstick: :: add DividerView
uuuunseo a1ec202
:sparkles: :: add readingBookCollectionView
uuuunseo c5c7a3a
:recycle: :: collectionView section contentInsets 추가
uuuunseo 1ee2f39
:recycle: :: Color 수정
uuuunseo 2a018f5
:sparkles: :: BookListSectionRowView 추가
uuuunseo 3886d05
:recycle: :: UIControl로 변경
uuuunseo a68101a
:recycle: :: cancellation 추가
uuuunseo a5a6976
:recycle: :: BookListSectionRowView UIControl로 변경
uuuunseo a5367fa
:recycle: :: imageDownloadTask 수정
uuuunseo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
ONMIR.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
ONMIR/Assets.xcassets/ButtonBackground.colorset/Contents.json
This file contains hidden or 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,38 @@ | ||
| { | ||
| "colors" : [ | ||
| { | ||
| "color" : { | ||
| "color-space" : "srgb", | ||
| "components" : { | ||
| "alpha" : "1.000", | ||
| "blue" : "0x00", | ||
| "green" : "0x00", | ||
| "red" : "0x00" | ||
| } | ||
| }, | ||
| "idiom" : "universal" | ||
| }, | ||
| { | ||
| "appearances" : [ | ||
| { | ||
| "appearance" : "luminosity", | ||
| "value" : "dark" | ||
| } | ||
| ], | ||
| "color" : { | ||
| "color-space" : "srgb", | ||
| "components" : { | ||
| "alpha" : "1.000", | ||
| "blue" : "0xFF", | ||
| "green" : "0xFF", | ||
| "red" : "0xFF" | ||
| } | ||
| }, | ||
| "idiom" : "universal" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
This file contains hidden or 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,38 @@ | ||
| { | ||
| "colors" : [ | ||
| { | ||
| "color" : { | ||
| "color-space" : "srgb", | ||
| "components" : { | ||
| "alpha" : "1.000", | ||
| "blue" : "0xFF", | ||
| "green" : "0xFF", | ||
| "red" : "0xFE" | ||
| } | ||
| }, | ||
| "idiom" : "universal" | ||
| }, | ||
| { | ||
| "appearances" : [ | ||
| { | ||
| "appearance" : "luminosity", | ||
| "value" : "dark" | ||
| } | ||
| ], | ||
| "color" : { | ||
| "color-space" : "srgb", | ||
| "components" : { | ||
| "alpha" : "1.000", | ||
| "blue" : "0x00", | ||
| "green" : "0x00", | ||
| "red" : "0x00" | ||
| } | ||
| }, | ||
| "idiom" : "universal" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
113 changes: 113 additions & 0 deletions
113
ONMIR/Feature/Home/Components/BookListSectionRowView.swift
This file contains hidden or 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,113 @@ | ||
| import SnapKit | ||
| import UIKit | ||
|
|
||
| final class BookListSectionRowView: UIControl { | ||
| private let bookListStackView: UIStackView = { | ||
| let stackView = UIStackView() | ||
| stackView.axis = .vertical | ||
| stackView.spacing = 12 | ||
| stackView.alignment = .leading | ||
| stackView.distribution = .fill | ||
| return stackView | ||
| }() | ||
|
|
||
| private let listContentStackView: UIStackView = { | ||
| let stackView = UIStackView() | ||
| stackView.axis = .horizontal | ||
| stackView.spacing = 12 | ||
| stackView.alignment = .center | ||
| stackView.distribution = .fill | ||
| return stackView | ||
| }() | ||
|
|
||
| private let divider1 = DividerView() | ||
| private let divider2 = DividerView() | ||
|
|
||
| private let listIcon: UIImageView = { | ||
| let imageview = UIImageView() | ||
| imageview.contentMode = .scaleAspectFit | ||
| imageview.backgroundColor = .clear | ||
| imageview.image = UIImage(systemName: "list.bullet") | ||
| imageview.tintColor = .label | ||
| return imageview | ||
| }() | ||
|
|
||
| private let listTitleLabel: UILabel = { | ||
| let label = UILabel() | ||
| label.text = "All" | ||
| label.font = .systemFont(ofSize: 16) | ||
| return label | ||
| }() | ||
|
|
||
| private let chevronRightIcon: UIImageView = { | ||
| let imageview = UIImageView() | ||
| imageview.contentMode = .scaleAspectFit | ||
| imageview.backgroundColor = .clear | ||
| imageview.image = UIImage(systemName: "chevron.right") | ||
| imageview.tintColor = UIColor.quaternaryLabel | ||
| return imageview | ||
| }() | ||
|
|
||
| init(title: String) { | ||
| super.init(frame: .zero) | ||
| self.listTitleLabel.text = title | ||
|
|
||
| setupView() | ||
| setupLayout() | ||
| } | ||
|
|
||
| required init?(coder: NSCoder) { | ||
| fatalError("init(coder:) has not been implemented") | ||
| } | ||
|
|
||
| override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { | ||
| guard let touch = touches.first else { return } | ||
| let location = touch.location(in: self) | ||
| if bounds.contains(location) { | ||
| sendActions(for: .touchUpInside) | ||
| } | ||
| } | ||
|
|
||
| private func setupView() { | ||
| self.backgroundColor = .clear | ||
|
|
||
| isUserInteractionEnabled = true | ||
|
|
||
| listContentStackView.addArrangedSubview(listIcon) | ||
| listContentStackView.addArrangedSubview(listTitleLabel) | ||
| listContentStackView.addArrangedSubview(chevronRightIcon) | ||
|
|
||
| bookListStackView.addArrangedSubview(divider1) | ||
| bookListStackView.addArrangedSubview(listContentStackView) | ||
| bookListStackView.addArrangedSubview(divider2) | ||
|
|
||
| addSubview(bookListStackView) | ||
| } | ||
|
|
||
| private func setupLayout() { | ||
| bookListStackView.snp.makeConstraints { make in | ||
| make.top.leading.trailing.bottom.equalToSuperview() | ||
| } | ||
|
|
||
| listContentStackView.snp.makeConstraints { make in | ||
| make.leading.trailing.equalToSuperview() | ||
| } | ||
|
|
||
| listIcon.snp.makeConstraints { make in | ||
| make.width.height.equalTo(24) | ||
| } | ||
|
|
||
| chevronRightIcon.snp.makeConstraints { make in | ||
| make.width.equalTo(12) | ||
| make.height.equalTo(17) | ||
| } | ||
|
|
||
| divider1.snp.makeConstraints { make in | ||
| make.leading.trailing.equalToSuperview() | ||
| } | ||
|
|
||
| divider2.snp.makeConstraints { make in | ||
| make.leading.trailing.equalToSuperview() | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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,17 @@ | ||
| import UIKit | ||
|
|
||
| final class DividerView: UIView { | ||
| init(height: CGFloat = 1.0, color: UIColor = UIColor.quaternaryLabel) { | ||
| super.init(frame: .zero) | ||
|
|
||
| self.backgroundColor = color | ||
| self.translatesAutoresizingMaskIntoConstraints = false | ||
| NSLayoutConstraint.activate([ | ||
| self.heightAnchor.constraint(equalToConstant: height) | ||
| ]) | ||
| } | ||
|
|
||
| required init?(coder: NSCoder) { | ||
| fatalError("init(coder:) has not been implemented") | ||
| } | ||
| } |
This file contains hidden or 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,73 @@ | ||
| import Nuke | ||
| import SnapKit | ||
| import UIKit | ||
|
|
||
| extension HomeViewController { | ||
| final class ReadingBookCell: UICollectionViewCell { | ||
| static let id: String = "ReadingBookCell" | ||
| private let coverImageView: UIImageView = { | ||
| let imageView = UIImageView() | ||
| imageView.contentMode = .scaleAspectFill | ||
| imageView.clipsToBounds = true | ||
| return imageView | ||
| }() | ||
|
|
||
| private let readingProgressLabel: UILabel = { | ||
| let label = UILabel() | ||
| label.font = .systemFont(ofSize: 27, weight: .bold) | ||
| return label | ||
| }() | ||
|
|
||
| private var imageDownloadTask: Task<Void, Never>? | ||
|
|
||
| override init(frame: CGRect) { | ||
| super.init(frame: frame) | ||
| setupUI() | ||
| } | ||
|
|
||
| required init?(coder: NSCoder) { | ||
| fatalError("init(coder:) has not been implemented") | ||
| } | ||
|
|
||
| override func prepareForReuse() { | ||
| super.prepareForReuse() | ||
| imageDownloadTask?.cancel() | ||
| } | ||
|
|
||
| private func setupUI() { | ||
| self.backgroundColor = .clear | ||
| contentView.backgroundColor = .clear | ||
|
|
||
| contentView.addSubview(coverImageView) | ||
| contentView.addSubview(readingProgressLabel) | ||
|
|
||
| coverImageView.snp.makeConstraints { make in | ||
| make.leading.trailing.equalToSuperview() | ||
| make.height.equalTo(392) | ||
| } | ||
|
|
||
| readingProgressLabel.snp.makeConstraints { make in | ||
| make.top.equalTo(coverImageView.snp.bottom).offset(8) | ||
| make.leading.equalToSuperview() | ||
| } | ||
| } | ||
|
|
||
| func prepare(imageURL: URL?, currentPage: Int, totalPage: Int) { | ||
| let percentage = Int(Double(currentPage) / Double(totalPage) * 100) | ||
| self.readingProgressLabel.text = "\(percentage)%" | ||
|
|
||
| if let thumbnailURL = imageURL { | ||
| imageDownloadTask = Task { | ||
| do { | ||
| let image = try await ImagePipeline.shared.image(for: thumbnailURL) | ||
baekteun marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if !Task.isCancelled { | ||
| self.coverImageView.image = image | ||
| } | ||
| } catch { | ||
| Logger.error(error) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.