Skip to content

Commit 965c53b

Browse files
committedMar 23, 2022
😁 Small optimizations
1 parent 0088a5e commit 965c53b

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed
 

‎Sources/ShinySwiftUI/Extensions/SwiftUI/Text.swift

+1-6
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ public extension Text {
1919
- parameter value: The value to animate.
2020
*/
2121
func transition(_ t: AnyTransition, value: String) -> some View {
22-
TextTransitionIDGenerator.count += 1
23-
return self.transition(t).id("_t\(TextTransitionIDGenerator.count)\(value)")
22+
return self.transition(t).id("_t\(value)")
2423
}
2524
}
26-
27-
fileprivate struct TextTransitionIDGenerator {
28-
static var count: Int = 0
29-
}

‎Sources/ShinySwiftUI/Extensions/SwiftUI/View/View+Highlight.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ fileprivate struct HighlightView<Content>: View where Content: View {
4141
content
4242
.overlay(
4343
RoundedRectangle(cornerRadius: .xs)
44-
.stroke(.yellow.if(value == index), lineWidth: 2.0)
44+
.stroke(value.wrappedValue == index ? .yellow : .clear, lineWidth: 2.0)
45+
.animation(.none, value: value.wrappedValue)
4546
)
4647
.slickAnimation(value: value.wrappedValue)
4748
.onAppear { animate = true }

0 commit comments

Comments
 (0)
Please sign in to comment.