File tree 4 files changed +37
-12
lines changed
4 files changed +37
-12
lines changed Original file line number Diff line number Diff line change
1
+ import SwiftUI
2
+
3
+ /// Вьюшка для системной иконки с настройкой фрейма
4
+ ///
5
+ /// - По умолчанию имеет `.symbolVariant(.circle)` и размер `15 * 15`
6
+ /// - Цвет - `Color.swAccent`
7
+ struct SystemImageWithFrame : View {
8
+ private let systemName : String
9
+ private let size : CGSize
10
+ private let isCircle : Bool
11
+
12
+ init (
13
+ _ systemName: String ,
14
+ size: CGSize = . init( width: 15 , height: 15 ) ,
15
+ isCircle: Bool = true
16
+ ) {
17
+ self . systemName = systemName
18
+ self . size = size
19
+ self . isCircle = isCircle
20
+ }
21
+
22
+ var body : some View {
23
+ Image ( systemName: systemName)
24
+ . resizable ( )
25
+ . scaledToFit ( )
26
+ . frame ( width: size. width, height: size. height)
27
+ . symbolVariant ( isCircle ? . circle : . none)
28
+ . foregroundStyle ( Color . swAccent)
29
+ }
30
+ }
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ public enum Icons {
16
16
case settings = " gearshape "
17
17
18
18
public var view : some View { Image ( systemName: rawValue) }
19
+ public var imageView : Image { Image ( systemName: rawValue) }
19
20
}
20
21
21
22
/// Названия остальных иконок
@@ -25,7 +26,7 @@ public enum Icons {
25
26
case eye
26
27
case checkmark
27
28
case share = " square.and.arrow.up "
28
- case noSignal = " wifi.exclamationmark "
29
+ case noSignal = " wifi.slash "
29
30
case gearshape
30
31
case refresh = " arrow.triangle.2.circlepath "
31
32
case exclamation = " exclamationmark.triangle "
@@ -50,6 +51,7 @@ public enum Icons {
50
51
case chevron = " chevron.forward "
51
52
52
53
public var view : some View { Image ( systemName: rawValue) }
54
+ public var imageView : Image { Image ( systemName: rawValue) }
53
55
}
54
56
}
55
57
Original file line number Diff line number Diff line change @@ -49,8 +49,7 @@ private extension EventRowView {
49
49
50
50
var eventDateTimeInfo : some View {
51
51
HStack ( spacing: 6 ) {
52
- Icons . Regular. clock. view
53
- . foregroundStyle ( Color . swAccent)
52
+ SystemImageWithFrame ( Icons . Regular. clock. rawValue, isCircle: false )
54
53
Text ( dateTimeText)
55
54
. foregroundStyle ( Color . swSmallElements)
56
55
. font ( . subheadline)
@@ -63,9 +62,7 @@ private extension EventRowView {
63
62
var locationInfoIfNeeded : some View {
64
63
if let locationText {
65
64
HStack ( spacing: 6 ) {
66
- Icons . Regular. location. view
67
- . symbolVariant ( . circle)
68
- . foregroundStyle ( Color . swAccent)
65
+ SystemImageWithFrame ( Icons . Regular. location. rawValue)
69
66
Text ( locationText)
70
67
. foregroundColor ( . swSmallElements)
71
68
. font ( . subheadline)
Original file line number Diff line number Diff line change @@ -52,19 +52,15 @@ private extension SportsGroundRowView {
52
52
var addressIfNeeded : some View {
53
53
if let address {
54
54
HStack ( spacing: 6 ) {
55
- Icons . Regular. location. view
56
- . symbolVariant ( . circle)
57
- . foregroundStyle ( Color . swAccent)
55
+ SystemImageWithFrame ( Icons . Regular. location. rawValue)
58
56
makeSubtitleView ( with: address)
59
57
}
60
58
}
61
59
}
62
60
63
61
var participantsInfo : some View {
64
62
HStack ( spacing: 6 ) {
65
- Icons . Regular. person. view
66
- . symbolVariant ( . circle)
67
- . foregroundStyle ( Color . swAccent)
63
+ SystemImageWithFrame ( Icons . Regular. person. rawValue)
68
64
makeSubtitleView ( with: usersTrainHereText)
69
65
}
70
66
}
You can’t perform that action at this time.
0 commit comments