@@ -19,8 +19,8 @@ public extension View {
19
19
- parameter value: The `Binding` value to check. If it matches `index`, the highlight will display.
20
20
*/
21
21
@ViewBuilder
22
- func highlight( _ index: Int , monitoring value: Binding < Int ? > ) -> some View {
23
- HighlightView ( content: { self } , index: index, value: value)
22
+ func highlight( _ index: Int , cornerRadius : CGFloat = . xs , monitoring value: Binding < Int ? > ) -> some View {
23
+ HighlightView ( content: { self } , index: index, cornerRadius : cornerRadius , value: value)
24
24
}
25
25
}
26
26
@@ -31,6 +31,7 @@ fileprivate struct HighlightView<Content>: View where Content: View {
31
31
@State var animate : Bool = false
32
32
33
33
var index : Int
34
+ var cornerRadius : CGFloat
34
35
var value : Binding < Int ? >
35
36
36
37
var show : Bool {
@@ -40,15 +41,15 @@ fileprivate struct HighlightView<Content>: View where Content: View {
40
41
var body : some View {
41
42
content
42
43
. overlay (
43
- RoundedRectangle ( cornerRadius: . xs )
44
- . stroke ( value. wrappedValue == index ? . yellow : . clear, lineWidth: 2.0 )
44
+ RoundedRectangle ( cornerRadius: cornerRadius )
45
+ . stroke ( value. wrappedValue == index ? . orange : . clear, lineWidth: 2.0 )
45
46
. animation ( . none, value: value. wrappedValue)
46
47
)
47
48
. slickAnimation ( value: value. wrappedValue)
48
49
. onAppear { animate = true }
49
50
. overlay (
50
51
Image ( systemName: " chevron.down " )
51
- . foregroundColor ( . yellow . if ( value == index) )
52
+ . foregroundColor ( . orange . if ( value == index) )
52
53
. animation ( . lightBounce. repeatForever ( autoreverses: false ) , value: animate)
53
54
. offset ( y: animate ? 10.0 : 0.0 )
54
55
. offset ( y: - 50.0 )
0 commit comments