Skip to content

Commit f80dd3b

Browse files
committed
Рефактор иконок
И форматирование в ридми
1 parent 93757b4 commit f80dd3b

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# SWDesignSystem
22

33
Дизайн-система для приложения [Street Workout: Площадки](http://workout.su/ios)
4-
[Ссылка на фигму](https://clck.ru/36D7Sd)
4+
- [Ссылка на фигму](https://clck.ru/36D7Sd)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import SwiftUI
2+
3+
/// Шеврон из дизайн-системы
4+
public struct ChevronView: View {
5+
public init() {}
6+
7+
public var body: some View {
8+
Image(systemName: Icons.Regular.chevron.rawValue)
9+
.resizable()
10+
.frame(width: 7, height: 12)
11+
.foregroundColor(.swSmallElements)
12+
}
13+
}
14+
15+
#if DEBUG
16+
#Preview { ChevronView() }
17+
#endif

Sources/SWDesignSystem/Public/Icons.swift

+6-23
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public enum Icons {
1414
case messages = "message"
1515
case profile = "person"
1616
case settings = "gearshape"
17+
18+
public var view: some View { Image(systemName: rawValue) }
1719
}
1820

1921
/// Названия остальных иконок
@@ -43,17 +45,9 @@ public enum Icons {
4345
case globe = "globe.europe.africa"
4446
case personQuestion = "person.fill.questionmark"
4547
case calendar
46-
}
47-
48-
public enum Misc: String, CaseIterable {
4948
case chevron = "chevron.forward"
50-
51-
static var chevronView: some View {
52-
Image(systemName: Icons.Misc.chevron.rawValue)
53-
.resizable()
54-
.frame(width: 7, height: 12)
55-
.foregroundColor(.swSmallElements)
56-
}
49+
50+
public var view: some View { Image(systemName: rawValue) }
5751
}
5852
}
5953

@@ -64,7 +58,7 @@ public enum Icons {
6458
VStack(alignment: .leading, spacing: 16) {
6559
ForEach(Icons.Tabbar.allCases, id: \.rawValue) { icon in
6660
HStack(spacing: 16) {
67-
Image(systemName: icon.rawValue)
61+
icon.view
6862
Text(icon.rawValue)
6963
}
7064
}
@@ -74,24 +68,13 @@ public enum Icons {
7468
VStack(alignment: .leading, spacing: 16) {
7569
ForEach(Icons.Regular.allCases, id: \.rawValue) { icon in
7670
HStack(spacing: 16) {
77-
Image(systemName: icon.rawValue)
78-
Text(icon.rawValue)
79-
}
80-
}
81-
}
82-
}
83-
Section("Misc icons") {
84-
VStack(alignment: .leading, spacing: 16) {
85-
ForEach(Icons.Misc.allCases, id: \.rawValue) { icon in
86-
HStack(spacing: 16) {
87-
Image(systemName: icon.rawValue)
71+
icon.view
8872
Text(icon.rawValue)
8973
}
9074
}
9175
}
9276
}
9377
}
94-
.listStyle(.plain)
9578
.previewDisplayName("Icons")
9679
}
9780
#endif

Sources/SWDesignSystem/Public/Rows/FormRowView.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ public extension FormRowView {
5050
case let .textWithChevron(text):
5151
HStack(spacing: 12) {
5252
trailingTextView(text)
53-
if isEnabled { Icons.Misc.chevronView }
53+
if isEnabled { ChevronView() }
5454
}
5555
case let .textWithBadgeAndChevron(text, badgeValue):
5656
HStack(spacing: 12) {
5757
trailingTextView(text)
5858
if badgeValue > 0 {
5959
BadgeView(value: badgeValue)
6060
}
61-
if isEnabled { Icons.Misc.chevronView }
61+
if isEnabled { ChevronView() }
6262
}
6363
}
6464
}

Sources/SWDesignSystem/Public/Rows/ListRowView.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ public extension ListRowView {
8282
case .empty:
8383
EmptyView()
8484
case .chevron:
85-
if isEnabled { Icons.Misc.chevronView }
85+
if isEnabled { ChevronView() }
8686
case let .text(text):
8787
makeTextView(with: .init(text))
8888
case let .textWithChevron(text):
8989
HStack(spacing: 12) {
9090
makeTextView(with: .init(text))
91-
if isEnabled { Icons.Misc.chevronView }
91+
if isEnabled { ChevronView() }
9292
}
9393
}
9494
}

0 commit comments

Comments
 (0)