diff --git a/CodeEdit/Features/About/Acknowledgements/Views/AcknowledgementsView.swift b/CodeEdit/Features/About/Acknowledgements/Views/AcknowledgementsView.swift index 43fe9767b5..b40641a30b 100644 --- a/CodeEdit/Features/About/Acknowledgements/Views/AcknowledgementsView.swift +++ b/CodeEdit/Features/About/Acknowledgements/Views/AcknowledgementsView.swift @@ -14,7 +14,7 @@ struct AcknowledgementsView: View { var body: some View { AboutDetailView(title: "Acknowledgements", aboutMode: $aboutMode, namespace: namespace) { - VStack(spacing: 0) { + LazyVStack(spacing: 0) { ForEach( model.indexedAcknowledgements, id: \.acknowledgement.name diff --git a/CodeEdit/Features/About/Contributors/ContributorsView.swift b/CodeEdit/Features/About/Contributors/ContributorsView.swift index ed60e247fb..c14ecb625f 100644 --- a/CodeEdit/Features/About/Contributors/ContributorsView.swift +++ b/CodeEdit/Features/About/Contributors/ContributorsView.swift @@ -14,7 +14,7 @@ struct ContributorsView: View { var body: some View { AboutDetailView(title: "Contributors", aboutMode: $aboutMode, namespace: namespace) { - VStack(spacing: 0) { + LazyVStack(spacing: 0) { ForEach(model.contributors) { contributor in ContributorRowView(contributor: contributor) Divider() diff --git a/CodeEdit/Features/About/Views/AboutDefaultView.swift b/CodeEdit/Features/About/Views/AboutDefaultView.swift index 62312c51f0..8997b572b4 100644 --- a/CodeEdit/Features/About/Views/AboutDefaultView.swift +++ b/CodeEdit/Features/About/Views/AboutDefaultView.swift @@ -44,6 +44,7 @@ struct AboutDefaultView: View { VStack(spacing: 0) { Text("CodeEdit") .matchedGeometryEffect(id: "Title", in: namespace, properties: .position, anchor: .center) + .blur(radius: aboutMode == .about ? 0 : 10) .foregroundColor(.primary) .font(.system( size: 26, @@ -61,6 +62,8 @@ struct AboutDefaultView: View { properties: .position, anchor: UnitPoint(x: 0.5, y: -0.75) ) + .blur(radius: aboutMode == .about ? 0 : 10) + .opacity(aboutMode == .about ? 1 : 0) } .padding(.horizontal) } @@ -106,6 +109,8 @@ struct AboutDefaultView: View { } .matchedGeometryEffect(id: "Titlebar", in: namespace, properties: .position, anchor: .top) .matchedGeometryEffect(id: "ScrollView", in: namespace, properties: .position, anchor: .top) + .blur(radius: aboutMode == .about ? 0 : 10) + .opacity(aboutMode == .about ? 1 : 0) } .padding(.horizontal) } diff --git a/CodeEdit/Features/About/Views/AboutDetailView.swift b/CodeEdit/Features/About/Views/AboutDetailView.swift index 0d44d7f547..44bb338c03 100644 --- a/CodeEdit/Features/About/Views/AboutDetailView.swift +++ b/CodeEdit/Features/About/Views/AboutDetailView.swift @@ -46,6 +46,8 @@ struct AboutDetailView: View { } .frame(maxWidth: .infinity) .matchedGeometryEffect(id: "ScrollView", in: namespace, properties: .position, anchor: .top) + .blur(radius: aboutMode != .about ? 0 : 10) + .opacity(aboutMode != .about ? 1 : 0) .clipShape(Rectangle()) } @@ -113,6 +115,8 @@ struct AboutDetailView: View { } .contentShape(Rectangle()) .matchedGeometryEffect(id: "Title", in: namespace, properties: .position, anchor: .center) + .blur(radius: aboutMode != .about ? 0 : 10) + .opacity(aboutMode != .about ? 1 : 0) } .buttonStyle(.plain) @@ -135,9 +139,17 @@ struct AboutDetailView: View { minOffset: CGFloat, maxOffset: CGFloat ) -> CGFloat { + let currentOffset = scrollOffset + let threshold: CGFloat = 1.0 + + /// Prevents unnecessary view updates if the scroll offset is below the threshold + if abs(currentOffset) < threshold { + return minValue + } + let valueRange = maxValue - minValue let offsetRange = maxOffset - minOffset - let currentOffset = scrollOffset + let percentage = (currentOffset - minOffset) / offsetRange let value = minValue + (valueRange * percentage) diff --git a/CodeEdit/Features/About/Views/AboutView.swift b/CodeEdit/Features/About/Views/AboutView.swift index 900177edb9..1dbed8944d 100644 --- a/CodeEdit/Features/About/Views/AboutView.swift +++ b/CodeEdit/Features/About/Views/AboutView.swift @@ -36,7 +36,7 @@ public struct AboutView: View { ContributorsView(aboutMode: $aboutMode, namespace: animator) } } - .animation(.spring(), value: aboutMode) + .animation(.smooth, value: aboutMode) .ignoresSafeArea() .frame(width: 280, height: 400 - 28) .fixedSize()