-
Notifications
You must be signed in to change notification settings - Fork 1
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
[iOS] RewindJourney Scene UI #153
Merged
SwiftyJunnos
merged 20 commits into
iOS/epic/RewindJourneyScene
from
iOS/task/RewindJourneySceneUI
Nov 30, 2023
Merged
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
f8c2bb7
:memo: RewindJourney 패키지 파일 생성 및 필요한 패키지 의존성 추가
3ce8ed0
:memo: 구현에 필요한 UIKit 가져오기
7dabb80
:memo: 경로 변경에 따른 package 파일 수정
3881f2f
:sparkles: UI Scene 구현
d93c2ca
:art: 불필요한 코드 삭제(코드 정리)
2c0281a
Merge branch 'iOS/release' into iOS/story/RewindJourneyScene
SwiftyJunnos 0845ff6
:sparkles: Preview 코드 추가
66b2ca4
:memo: Commit 문서 현 Feature package에 Lint 적용하도록 수정
45e741c
:sparkles: Preview 추가
cafd77b
:art: Lint 규칙 적용
8b6b499
:art: Lint 규칙 적용
a5cfcff
:art: Package 파일 Lint 규칙에 맞추어 수정
f8291df
Merge branch 'iOS/story/RewindJourneyScene' of https://github.com/boo…
c437c8e
:memo: Lint 규칙 수정: 중첩 타입 조건 완화(warning 2 -> 3)
28fb5dd
:art: 접근 제한자, 변수명 수정
c72b403
:sparkles: 되감기 기능 수정: 전에 보여주었던 이미지들의 progressView도 하이라이트 처리
f06e0d5
:art: 상수 변수 read-only로 변경
a4e92a5
:art: 변수명 변경 isHighlight -> isHighlighted
818be26
:sparkles: Preview 추가, album art 표지 변경 기능 추가
d31995e
:memo: Resolve conflict
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
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 |
---|---|---|
|
@@ -26,3 +26,9 @@ type_name: | |
max_length: | ||
warning: 40 | ||
error: 1000 | ||
|
||
# 중첩 타입 | ||
nesting: | ||
type_level: | ||
warning: 3 | ||
error: 4 |
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,8 @@ | ||
.DS_Store | ||
/.build | ||
/Packages | ||
xcuserdata/ | ||
DerivedData/ | ||
.swiftpm/configuration/registries.json | ||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata | ||
.netrc |
8 changes: 8 additions & 0 deletions
8
...es/RewindJourney/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
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,57 @@ | ||
// swift-tools-version: 5.9 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
// MARK: - Constants | ||
|
||
extension String { | ||
static let package = "RewindJourney" | ||
static let rewindJourneyView = "RewindJourneyView" | ||
static let msUIKit = "MSUIKit" | ||
static let msFoundation = "MSFoundation" | ||
static let msDesignsystem = "MSDesignSystem" | ||
static let msLogger = "MSLogger" | ||
|
||
var testTarget: String { | ||
return self + "Tests" | ||
} | ||
|
||
var path: String { | ||
return "../../" + self | ||
} | ||
|
||
var featurePath: String { | ||
return "../Features/" + self | ||
} | ||
|
||
} | ||
|
||
// MARK: - Package | ||
|
||
let package = Package( | ||
name: .package, | ||
platforms: [ | ||
.iOS(.v15) | ||
], | ||
products: [ | ||
.library( | ||
name: .rewindJourneyView, | ||
targets: [.rewindJourneyView]) | ||
], | ||
dependencies: [ | ||
.package(path: .msUIKit.path), | ||
.package(path: .msFoundation.path) | ||
], | ||
targets: [ | ||
// Codes | ||
.target( | ||
name: .rewindJourneyView, | ||
dependencies: [ | ||
.product(name: .msUIKit, package: .msUIKit), | ||
.product(name: .msDesignsystem, package: .msUIKit), | ||
.product(name: .msLogger, package: .msFoundation)]) | ||
|
||
// Tests | ||
] | ||
) |
183 changes: 183 additions & 0 deletions
183
iOS/Features/RewindJourney/Sources/RewindJourneyView/MSMusicView.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,183 @@ | ||
// | ||
// MSMusicView.swift | ||
// RewindJourney | ||
// | ||
// Created by 전민건 on 11/22/23. | ||
// | ||
|
||
import UIKit | ||
|
||
import MSDesignSystem | ||
import MSLogger | ||
import MSUIKit | ||
|
||
final class MSMusicView: UIProgressView { | ||
|
||
// MARK: - Constants | ||
|
||
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. 이렇게 따로 Metric을 두는 방식을 쓰시는군요..! |
||
private enum Metric { | ||
|
||
static let verticalInset: CGFloat = 8.0 | ||
static let horizonalInset: CGFloat = 12.0 | ||
static let cornerRadius: CGFloat = 8.0 | ||
|
||
// albumart view | ||
enum AlbumArtView { | ||
static let height: CGFloat = 52.0 | ||
static let width: CGFloat = 52.0 | ||
} | ||
// title view | ||
enum TitleView { | ||
static let height: CGFloat = 4.0 | ||
static let inset: CGFloat = 4.0 | ||
static let titleHight: CGFloat = 24.0 | ||
static let subTitleHight: CGFloat = 20.0 | ||
} | ||
|
||
// playtime view | ||
enum PlayTimeView { | ||
static let width: CGFloat = 67.0 | ||
static let verticalInset: CGFloat = 22.0 | ||
static let horizonalInset: CGFloat = 4.0 | ||
static let conponentsHeight: CGFloat = 24.0 | ||
} | ||
|
||
} | ||
|
||
private enum Default { | ||
|
||
// titleView | ||
enum TitleView { | ||
static let title: String = "Attention" | ||
static let subTitle: String = "NewJeans" | ||
static let defaultIndex: Int = 0 | ||
} | ||
|
||
// stackView | ||
enum PlayTime { | ||
static let time: String = "00 : 00" | ||
} | ||
|
||
} | ||
|
||
// MARK: - UI Components | ||
|
||
private let albumArtView = UIImageView() | ||
public var albumArtImage: UIImage? { | ||
didSet { | ||
self.albumArtView.image = albumArtImage | ||
} | ||
} | ||
private let titleStackView = UIStackView() | ||
private let titleLabel = UILabel() | ||
private let subTitleLabel = UILabel() | ||
private let playTimeStackView = UIStackView() | ||
private let playTimeLabel = UILabel() | ||
private let playTimeIconView = UIImageView(image: .msIcon(.voice)) | ||
|
||
// MARK: - UI Configuration | ||
|
||
public func configure() { | ||
self.configureLayout() | ||
self.configureStyle() | ||
} | ||
|
||
// MARK: - UI Configuration: layout | ||
|
||
private func configureLayout() { | ||
self.configureAlbumArtViewLayout() | ||
self.configurePlayTimeViewLayout() | ||
self.configureTitleViewLayout() | ||
} | ||
|
||
private func configureAlbumArtViewLayout() { | ||
self.addSubview(self.albumArtView) | ||
self.albumArtView.translatesAutoresizingMaskIntoConstraints = false | ||
NSLayoutConstraint.activate([ | ||
self.albumArtView.topAnchor.constraint(equalTo: self.topAnchor, constant: Metric.verticalInset), | ||
self.albumArtView.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -Metric.verticalInset), | ||
self.albumArtView.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: Metric.horizonalInset), | ||
self.albumArtView.widthAnchor.constraint(equalToConstant: Metric.AlbumArtView.width) | ||
]) | ||
} | ||
|
||
private func configureTitleViewLayout() { | ||
self.addSubview(self.titleStackView) | ||
self.titleStackView.translatesAutoresizingMaskIntoConstraints = false | ||
NSLayoutConstraint.activate([ | ||
self.titleStackView.topAnchor.constraint(equalTo: self.topAnchor, | ||
constant: Metric.verticalInset), | ||
self.titleStackView.bottomAnchor.constraint(equalTo: self.bottomAnchor, | ||
constant: -Metric.verticalInset), | ||
self.titleStackView.leadingAnchor.constraint(equalTo: self.albumArtView.trailingAnchor, | ||
constant: Metric.horizonalInset), | ||
self.titleStackView.trailingAnchor.constraint(equalTo: self.playTimeStackView.leadingAnchor, | ||
constant: -Metric.horizonalInset) | ||
]) | ||
|
||
self.titleStackView.addArrangedSubview(self.titleLabel) | ||
self.titleStackView.addArrangedSubview(self.subTitleLabel) | ||
|
||
self.titleStackView.axis = .vertical | ||
self.titleStackView.spacing = Metric.TitleView.inset | ||
} | ||
|
||
private func configurePlayTimeViewLayout() { | ||
self.addSubview(self.playTimeStackView) | ||
self.playTimeStackView.translatesAutoresizingMaskIntoConstraints = false | ||
NSLayoutConstraint.activate([ | ||
self.playTimeStackView.topAnchor.constraint(equalTo: self.topAnchor, | ||
constant: Metric.PlayTimeView.verticalInset), | ||
self.playTimeStackView.bottomAnchor.constraint(equalTo: self.bottomAnchor, | ||
constant: -Metric.PlayTimeView.verticalInset), | ||
self.playTimeStackView.widthAnchor.constraint(equalToConstant: Metric.PlayTimeView.width), | ||
self.playTimeStackView.trailingAnchor.constraint(equalTo: self.trailingAnchor, | ||
constant: -Metric.horizonalInset) | ||
]) | ||
|
||
self.playTimeStackView.addArrangedSubview(self.playTimeIconView) | ||
self.playTimeStackView.addArrangedSubview(self.playTimeLabel) | ||
|
||
self.playTimeStackView.axis = .horizontal | ||
self.playTimeStackView.spacing = Metric.PlayTimeView.horizonalInset | ||
self.titleStackView.distribution = .fill | ||
} | ||
|
||
// MARK: - UI Configuration: style | ||
|
||
private func configureStyle() { | ||
self.clipsToBounds = true | ||
self.layer.cornerRadius = Metric.cornerRadius | ||
self.trackTintColor = .msColor(.secondaryBackground) | ||
self.progressTintColor = .msColor(.musicSpot) | ||
self.progress = 0.4 | ||
|
||
self.configureTitleViewStyle() | ||
self.configurePlayTimeViewStyle() | ||
} | ||
|
||
private func configureTitleViewStyle() { | ||
self.titleLabel.text = Default.TitleView.title | ||
self.titleLabel.font = .msFont(.buttonTitle) | ||
self.subTitleLabel.text = Default.TitleView.subTitle | ||
self.subTitleLabel.font = .msFont(.paragraph) | ||
} | ||
|
||
private func configurePlayTimeViewStyle() { | ||
self.playTimeLabel.text = Default.PlayTime.time | ||
self.playTimeLabel.font = .msFont(.caption) | ||
self.playTimeLabel.textColor = .msColor(.secondaryTypo) | ||
self.playTimeIconView.tintColor = .msColor(.secondaryTypo) | ||
} | ||
|
||
} | ||
|
||
// MARK: - Preview | ||
|
||
@available(iOS 17, *) | ||
#Preview { | ||
MSFont.registerFonts() | ||
let musicView = MSMusicView() | ||
musicView.albumArtImage = UIImage(systemName: "pencil") | ||
return musicView | ||
} |
49 changes: 49 additions & 0 deletions
49
iOS/Features/RewindJourney/Sources/RewindJourneyView/MSProgressView.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,49 @@ | ||
// | ||
// MSProgressView.swift | ||
// RewindJourney | ||
// | ||
// Created by 전민건 on 11/22/23. | ||
// | ||
|
||
import UIKit | ||
|
||
public final class MSProgressView: UIProgressView { | ||
|
||
// MARK: - Properties | ||
|
||
internal var percentage: Float = 0.0 { | ||
didSet { | ||
syncProgress(percentage: percentage) | ||
} | ||
} | ||
internal var isHighlighted: Bool = false { | ||
didSet { | ||
self.percentage = self.isHighlighted ? 1.0 : 0.0 | ||
} | ||
} | ||
|
||
// MARK: - Configure | ||
|
||
private func configureColor() { | ||
self.trackTintColor = .systemGray6 | ||
self.tintColor = .white | ||
} | ||
|
||
// MARK: - Initializer | ||
|
||
public override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
self.configureColor() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("MusicSpot은 code-based 로 개발되었습니다.") | ||
} | ||
|
||
// MARK: - Functions: change progress | ||
|
||
private func syncProgress(percentage: Float) { | ||
self.progress = percentage | ||
} | ||
|
||
} |
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.
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.
이 부분 아마 변경되어서 따로 필요하지 않아도 될 듯 합니다..!