macos: swiftlint 'private_over_fileprivate' rule

This commit is contained in:
Jon Parise
2026-02-19 18:55:12 -05:00
parent 6052f664cf
commit 25b38b291e
12 changed files with 25 additions and 26 deletions

View File

@@ -22,7 +22,6 @@ disabled_rules:
- multiple_closures_with_trailing_closure
- no_fallthrough_only
- orphaned_doc_comment
- private_over_fileprivate
- shorthand_operator
- switch_case_alignment
- syntactic_sugar

View File

@@ -1359,6 +1359,6 @@ private enum QuickTerminalState {
}
@globalActor
fileprivate actor AppIconActor: GlobalActor {
private actor AppIconActor: GlobalActor {
static let shared = AppIconActor()
}

View File

@@ -229,7 +229,7 @@ struct CommandPaletteView: View {
}
/// The text field for building the query for the command palette.
fileprivate struct CommandPaletteQuery: View {
private struct CommandPaletteQuery: View {
@Binding var query: String
var onEvent: ((KeyboardEvent) -> Void)?
@FocusState private var isTextFieldFocused: Bool
@@ -284,7 +284,7 @@ fileprivate struct CommandPaletteQuery: View {
}
}
fileprivate struct CommandTable: View {
private struct CommandTable: View {
var options: [CommandOption]
@Binding var selectedIndex: UInt?
@Binding var hoveredOptionID: UUID?
@@ -332,7 +332,7 @@ fileprivate struct CommandTable: View {
}
/// A single row in the command palette.
fileprivate struct CommandRow: View {
private struct CommandRow: View {
let option: CommandOption
var isSelected: Bool
@Binding var hoveredID: UUID?
@@ -406,7 +406,7 @@ fileprivate struct CommandRow: View {
}
/// A row of Text representing a shortcut.
fileprivate struct ShortcutSymbolsView: View {
private struct ShortcutSymbolsView: View {
let symbols: [String]
var body: some View {

View File

@@ -171,7 +171,7 @@ struct TerminalCommandPaletteView: View {
}
/// This is done to ensure that the given view is in the responder chain.
fileprivate struct ResponderChainInjector: NSViewRepresentable {
private struct ResponderChainInjector: NSViewRepresentable {
let responder: NSResponder
func makeNSView(context: Context) -> NSView {

View File

@@ -117,7 +117,7 @@ class GlobalEventTap {
}
}
fileprivate func cgEventFlagsChangedHandler(
private func cgEventFlagsChangedHandler(
proxy: CGEventTapProxy,
type: CGEventType,
cgEvent: CGEvent,

View File

@@ -343,7 +343,7 @@ extension SplitTree {
// MARK: SplitTree Codable
fileprivate enum CodingKeys: String, CodingKey {
private enum CodingKeys: String, CodingKey {
case version
case root
case zoomed

View File

@@ -44,7 +44,7 @@ struct TerminalSplitTreeView: View {
}
}
fileprivate struct TerminalSplitSubtreeView: View {
private struct TerminalSplitSubtreeView: View {
@EnvironmentObject var ghostty: Ghostty.App
let node: SplitTree<Ghostty.SurfaceView>.Node
@@ -86,7 +86,7 @@ fileprivate struct TerminalSplitSubtreeView: View {
}
}
fileprivate struct TerminalSplitLeaf: View {
private struct TerminalSplitLeaf: View {
let surfaceView: Ghostty.SurfaceView
let isSplit: Bool
let action: (TerminalSplitOperation) -> Void

View File

@@ -127,7 +127,7 @@ struct TerminalView<ViewModel: TerminalViewModel>: View {
}
}
fileprivate struct UpdateOverlay: View {
private struct UpdateOverlay: View {
var body: some View {
if let appDelegate = NSApp.delegate as? AppDelegate {
VStack {

View File

@@ -506,7 +506,7 @@ class TitlebarTabsVenturaTerminalWindow: TerminalWindow {
}
// Passes mouseDown events from this view to window.performDrag so that you can drag the window by it.
fileprivate class WindowDragView: NSView {
private class WindowDragView: NSView {
override public func mouseDown(with event: NSEvent) {
// Drag the window for single left clicks, double clicks should bypass the drag handle.
if event.type == .leftMouseDown && event.clickCount == 1 {
@@ -535,7 +535,7 @@ fileprivate class WindowDragView: NSView {
}
// A view that matches the color of selected and unselected tabs in the adjacent tab bar.
fileprivate class WindowButtonsBackdropView: NSView {
private class WindowButtonsBackdropView: NSView {
// This must be weak because the window has this view. Otherwise
// a retain cycle occurs.
private weak var terminalWindow: TitlebarTabsVenturaTerminalWindow?
@@ -588,7 +588,7 @@ fileprivate class WindowButtonsBackdropView: NSView {
// Custom NSToolbar subclass that displays a centered window title,
// in order to accommodate the titlebar tabs feature.
fileprivate class TerminalToolbar: NSToolbar, NSToolbarDelegate {
private class TerminalToolbar: NSToolbar, NSToolbarDelegate {
private let titleTextField = CenteredDynamicLabel(labelWithString: "👻 Ghostty")
var titleText: String {
@@ -674,7 +674,7 @@ fileprivate class TerminalToolbar: NSToolbar, NSToolbarDelegate {
}
/// A label that expands to fit whatever text you put in it and horizontally centers itself in the current window.
fileprivate class CenteredDynamicLabel: NSTextField {
private class CenteredDynamicLabel: NSTextField {
override func viewDidMoveToSuperview() {
// Configure the text field
isEditable = false

View File

@@ -61,7 +61,7 @@ struct UpdateBadge: View {
/// A circular progress indicator with a stroke-based ring design.
///
/// Displays a partially filled circle that represents progress from 0.0 to 1.0.
fileprivate struct ProgressRingView: View {
private struct ProgressRingView: View {
/// The current progress value, ranging from 0.0 (empty) to 1.0 (complete)
let progress: Double

View File

@@ -52,7 +52,7 @@ struct UpdatePopoverView: View {
}
}
fileprivate struct PermissionRequestView: View {
private struct PermissionRequestView: View {
let request: UpdateState.PermissionRequest
let dismiss: DismissAction
@@ -93,7 +93,7 @@ fileprivate struct PermissionRequestView: View {
}
}
fileprivate struct CheckingView: View {
private struct CheckingView: View {
let checking: UpdateState.Checking
let dismiss: DismissAction
@@ -120,7 +120,7 @@ fileprivate struct CheckingView: View {
}
}
fileprivate struct UpdateAvailableView: View {
private struct UpdateAvailableView: View {
let update: UpdateState.UpdateAvailable
let dismiss: DismissAction
@@ -217,7 +217,7 @@ fileprivate struct UpdateAvailableView: View {
}
}
fileprivate struct DownloadingView: View {
private struct DownloadingView: View {
let download: UpdateState.Downloading
let dismiss: DismissAction
@@ -255,7 +255,7 @@ fileprivate struct DownloadingView: View {
}
}
fileprivate struct ExtractingView: View {
private struct ExtractingView: View {
let extracting: UpdateState.Extracting
var body: some View {
@@ -274,7 +274,7 @@ fileprivate struct ExtractingView: View {
}
}
fileprivate struct InstallingView: View {
private struct InstallingView: View {
let installing: UpdateState.Installing
let dismiss: DismissAction
@@ -313,7 +313,7 @@ fileprivate struct InstallingView: View {
}
}
fileprivate struct NotFoundView: View {
private struct NotFoundView: View {
let notFound: UpdateState.NotFound
let dismiss: DismissAction
@@ -343,7 +343,7 @@ fileprivate struct NotFoundView: View {
}
}
fileprivate struct UpdateErrorView: View {
private struct UpdateErrorView: View {
let error: UpdateState.Error
let dismiss: DismissAction

View File

@@ -10,7 +10,7 @@ struct MetalView<V: MTKView>: View {
}
}
fileprivate struct MetalViewRepresentable<V: MTKView>: NSViewRepresentable {
private struct MetalViewRepresentable<V: MTKView>: NSViewRepresentable {
@Binding var metalView: V
func makeNSView(context: Context) -> some NSView {