Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Pages appear at once, and only a list that changes fades

Țugui Dragoș70bdf1c6d329
diff --git a/Peel/Navigation/ColumnFade.swift b/Peel/Navigation/ColumnFade.swift
index 085ab713..ae01024b 100644
--- a/Peel/Navigation/ColumnFade.swift
+++ b/Peel/Navigation/ColumnFade.swift
@@ -2,11 +2,6 @@ import AppKit
import SwiftUI
extension View {
- /// Fades in this page's column when the page enters the window.
- func fadesInOnArrival() -> some View {
- background(ColumnFade(value: nil))
- }
-
/// Fades the column in again when `value` changes while the column is on screen. The first value never
/// fades, and a change while a fade is running does not start another.
func fadesInColumn(on value: some Hashable) -> some View {
@@ -23,15 +18,14 @@ extension View {
}
private struct ColumnFade: NSViewRepresentable {
- /// Nil for a page that fades only as it arrives.
- let value: AnyHashable?
+ let value: AnyHashable
func makeNSView(context: Context) -> Anchor {
- Anchor(fadesOnArrival: value == nil)
+ Anchor()
}
func updateNSView(_ anchor: Anchor, context: Context) {
- guard let value, anchor.value != value else { return }
+ guard anchor.value != value else { return }
if anchor.value != nil, anchor.window != nil, !anchor.isFading {
anchor.fadeIn()
}
@@ -39,25 +33,8 @@ private struct ColumnFade: NSViewRepresentable {
}
final class Anchor: NSView {
- let fadesOnArrival: Bool
var value: AnyHashable?
- init(fadesOnArrival: Bool) {
- self.fadesOnArrival = fadesOnArrival
- super.init(frame: .zero)
- }
-
- required init?(coder: NSCoder) {
- nil
- }
-
- override func viewDidMoveToWindow() {
- super.viewDidMoveToWindow()
- if window != nil, fadesOnArrival {
- fadeIn()
- }
- }
-
var isFading: Bool {
column?.layer?.animation(forKey: "fade") != nil
}
diff --git a/Peel/Views/ContentView.swift b/Peel/Views/ContentView.swift
index 6a052eb5..66b6b188 100644
--- a/Peel/Views/ContentView.swift
+++ b/Peel/Views/ContentView.swift
@@ -90,9 +90,7 @@ struct ContentView: View {
NavigationSplitView(columnVisibility: $columns) {
sidebar
} detail: {
- // Modifiers on a `Group` apply to each view inside it, so each page fades in on its own.
- Group { wholePage }
- .fadesInOnArrival()
+ wholePage
}
} else {
tools
@@ -282,7 +280,6 @@ struct ContentView: View {
// `ContentUnavailableView` is the visible case, drawing a lighter slab whose top edge reads as a
// line under the title bar. Hidden, the window's own material shows through instead.
.scrollContentBackground(.hidden)
- .fadesInOnArrival()
} detail: {
Group {
switch drawn.tool {
@@ -326,7 +323,6 @@ struct ContentView: View {
}
.frame(minWidth: 480)
.scrollContentBackground(.hidden)
- .fadesInOnArrival()
// Claims a title bar section for this column. SwiftUI only inserts its
// `NSTrackingSeparatorToolbarItem` once both columns carry a toolbar item, and that separator is
// what lets the divider run up through the title bar the way Notes and Mail do. An `EmptyView`
diff --git a/Peel/Views/History/HistoryDetailView.swift b/Peel/Views/History/HistoryDetailView.swift
index 1961816f..bcb8150e 100644
--- a/Peel/Views/History/HistoryDetailView.swift
+++ b/Peel/Views/History/HistoryDetailView.swift
@@ -74,7 +74,6 @@ struct HistoryDetailView: View {
records(in: standing)
}
}
- .fadesInColumn(on: standing == nil)
.safeAreaBar(edge: .bottom) {
RestoreBar(
count: selected.count,