Skip to content

Commit

Permalink
😁 Small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
benlmyers committed Mar 23, 2022
1 parent 0088a5e commit 965c53b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 1 addition & 6 deletions Sources/ShinySwiftUI/Extensions/SwiftUI/Text.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ public extension Text {
- parameter value: The value to animate.
*/
func transition(_ t: AnyTransition, value: String) -> some View {
TextTransitionIDGenerator.count += 1
return self.transition(t).id("_t\(TextTransitionIDGenerator.count)\(value)")
return self.transition(t).id("_t\(value)")
}
}

fileprivate struct TextTransitionIDGenerator {
static var count: Int = 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ fileprivate struct HighlightView<Content>: View where Content: View {
content
.overlay(
RoundedRectangle(cornerRadius: .xs)
.stroke(.yellow.if(value == index), lineWidth: 2.0)
.stroke(value.wrappedValue == index ? .yellow : .clear, lineWidth: 2.0)
.animation(.none, value: value.wrappedValue)
)
.slickAnimation(value: value.wrappedValue)
.onAppear { animate = true }
Expand Down

0 comments on commit 965c53b

Please sign in to comment.