Skip to content

Commit

Permalink
♻️::[#184] 새로운 문법으로 mealViews를 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
junseopark0331 committed Dec 29, 2023
1 parent 4568f75 commit 185978b
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,24 @@ final class MealContentStackView: UIStackView {
self.isLayoutMarginsRelativeArrangement = true
self.alignment = .leading
}

Check warning on line 15 in Projects/Feature/HomeFeature/Sources/Scene/View/MealContentStackView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
@available(*, unavailable)
required init(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

Check warning on line 20 in Projects/Feature/HomeFeature/Sources/Scene/View/MealContentStackView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
public func updateContent(meals: [String]) {
self.removeAllChildren()
var mealViews: [DotoriLabel] = []
if meals.isEmpty {
let emptyLabels = (1...6).map { _ in DotoriLabel("") }
mealViews.append(DotoriLabel("급식이 없습니다."))
mealViews.append(contentsOf: emptyLabels)
let mealViews: [DotoriLabel] = if meals.isEmpty {
[DotoriLabel("급식이 없습니다.")] + (1...6).map { _ in DotoriLabel("") }
} else {
mealViews = meals.map { DotoriLabel($0) }
meals.map { DotoriLabel($0) }
}
mealViews.forEach { view in
view.alpha = 0.0
self.addArrangedSubview(view)
}

Check warning on line 32 in Projects/Feature/HomeFeature/Sources/Scene/View/MealContentStackView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
for (index, view) in mealViews.enumerated() {
UIView.animate(withDuration: 0.5, delay: 0.05 * Double(index), options: [], animations: {
view.alpha = 1.0
Expand Down

0 comments on commit 185978b

Please sign in to comment.