Free, open-source macOS cleaner. CleanMyMac alternative with zero telemetry. Native SwiftUI, scheduled auto-cleaning, Xcode/Homebrew/system cache cleanup. MIT licensed.
Swift cache-cleanercleanmymaccleanupdisk-cleanerdisk-spacehomebrewmac-utilitymacosmacos-appmacos-cleanermacosxnativeossosxprivacyswiftswiftuisystem-cleanerxcode-cleaner
feat: app uninstaller with master-detail file discovery
moamen05cd3182f572
diff --git a/PureMac/ViewModels/AppState.swift b/PureMac/ViewModels/AppState.swiftindex 1a51abf..266615a 100644--- a/PureMac/ViewModels/AppState.swift+++ b/PureMac/ViewModels/AppState.swift@@ -40,6 +40,7 @@ final class AppState: ObservableObject {@Published var orphanedFiles: [URL] = []@Published var isSearchingOrphans: Bool = false@Published var isLoadingApps: Bool = false+ @Published var isScanningAppFiles: Bool = false// MARK: - Services@@ -93,6 +94,7 @@ final class AppState: ObservableObject {func scanForAppFiles(_ app: InstalledApp) {discoveredFiles = []selectedFiles = []+ isScanningAppFiles = truelet locations = Locations()let appInfo = AppPathFinder.AppInfo(appName: app.appName,@@ -107,6 +109,7 @@ final class AppState: ObservableObject {let sorted = urls.sorted { $0.path < $1.path }self.discoveredFiles = sortedself.selectedFiles = urls+ self.isScanningAppFiles = false}}diff --git a/PureMac/Views/Apps/AppFilesView.swift b/PureMac/Views/Apps/AppFilesView.swiftindex 039d6e8..ee5ab02 100644--- a/PureMac/Views/Apps/AppFilesView.swift+++ b/PureMac/Views/Apps/AppFilesView.swift@@ -4,6 +4,12 @@ struct AppFilesView: View {@EnvironmentObject var appState: AppStatelet app: InstalledApp+ private var totalSelectedSize: Int64 {+ appState.selectedFiles.reduce(Int64(0)) { total, url in+ total + (fileSize(url) ?? 0)+ }+ }+var body: some View {VStack(spacing: 0) {// App header@@ -14,7 +20,7 @@ struct AppFilesView: View {VStack(alignment: .leading, spacing: 2) {Text(app.appName)- .font(.title2)+ .font(.title3.bold())Text(app.bundleIdentifier).font(.caption).foregroundStyle(.secondary)@@ -23,21 +29,36 @@ struct AppFilesView: View {Spacer()if !appState.discoveredFiles.isEmpty {- let totalSize = appState.discoveredFiles.reduce(Int64(0)) { total, url in- total + (fileSize(url) ?? 0)+ VStack(alignment: .trailing, spacing: 2) {+ Text("\(appState.discoveredFiles.count) files")+ .font(.callout)+ .foregroundStyle(.secondary)+ Text(ByteCountFormatter.string(fromByteCount: totalSelectedSize, countStyle: .file))+ .font(.callout.bold())}- Text(ByteCountFormatter.string(fromByteCount: totalSize, countStyle: .file))- .font(.title3)- .monospacedDigit()- .foregroundStyle(.secondary)}}.padding()Divider()- if appState.discoveredFiles.isEmpty {- EmptyStateView("No Related Files Found", systemImage: "magnifyingglass", description: "No additional files were found for this application.")+ // Content+ if appState.isScanningAppFiles {+ VStack(spacing: 12) {+ Spacer()+ ProgressView("Scanning for related files...")+ Text("Checking \(appState.discoveredFiles.count) locations...")+ .font(.caption)+ .foregroundStyle(.secondary)+ Spacer()+ }+ .frame(maxWidth: .infinity, maxHeight: .infinity)+ } else if appState.discoveredFiles.isEmpty {+ EmptyStateView(+ "No Related Files",+ systemImage: "checkmark.circle",+ description: "No additional files found for \(app.appName)."+ )} else {List(appState.discoveredFiles, id: \.self) { fileURL inToggle(isOn: fileSelectionBinding(for: fileURL)) {@@ -72,11 +93,9 @@ struct AppFilesView: View {}}}- }- }- .toolbar {- ToolbarItemGroup {- if !appState.discoveredFiles.isEmpty {++ // Bottom action bar+ HStack {Button("Select All") {appState.selectedFiles = Set(appState.discoveredFiles)}@@ -84,14 +103,17 @@ struct AppFilesView: View {appState.selectedFiles.removeAll()}+ Spacer()+if !appState.selectedFiles.isEmpty {- Button("Remove Selected (\(appState.selectedFiles.count))", role: .destructive) {+ Button("Uninstall \(appState.selectedFiles.count) files (\(ByteCountFormatter.string(fromByteCount: totalSelectedSize, countStyle: .file)))", role: .destructive) {appState.removeSelectedFiles()}.buttonStyle(.borderedProminent).tint(.red)}}+ .padding()}}}diff --git a/PureMac/Views/Apps/AppListView.swift b/PureMac/Views/Apps/AppListView.swiftindex b7fd204..873ff75 100644--- a/PureMac/Views/Apps/AppListView.swift+++ b/PureMac/Views/Apps/AppListView.swift@@ -17,6 +17,37 @@ struct AppListView: View {}var body: some View {+ HSplitView {+ appTable+ .frame(minWidth: 300, idealWidth: 380)++ fileDetail+ .frame(minWidth: 300)+ }+ .searchable(text: $searchText, prompt: "Search apps")+ .navigationTitle("Installed Apps (\(appState.installedApps.count))")+ .toolbar {+ ToolbarItemGroup {+ Button {+ appState.loadInstalledApps()+ } label: {+ Label("Refresh", systemImage: "arrow.clockwise")+ }++ if !appState.selectedFiles.isEmpty {+ Button("Uninstall (\(appState.selectedFiles.count) files)", role: .destructive) {+ appState.removeSelectedFiles()+ }+ .buttonStyle(.borderedProminent)+ .tint(.red)+ }+ }+ }+ }++ // MARK: - App Table (left side)++ private var appTable: some View {Group {if appState.isLoadingApps {VStack(spacing: 12) {@@ -41,21 +72,14 @@ struct AppListView: View {Text(app.appName)}}- .width(min: 200)+ .width(min: 150)TableColumn("Size") { app inText(app.formattedSize).monospacedDigit().foregroundStyle(.secondary)}- .width(ideal: 80)-- TableColumn("Bundle Identifier") { app in- Text(app.bundleIdentifier)- .foregroundStyle(.tertiary)- .font(.caption)- }- .width(min: 180)+ .width(ideal: 70)}.onChange(of: selection) { newValue inif let id = newValue,@@ -66,16 +90,20 @@ struct AppListView: View {}}}- .searchable(text: $searchText, prompt: "Search apps")- .navigationTitle("Installed Apps (\(appState.installedApps.count))")- .toolbar {- ToolbarItem {- Button {- appState.loadInstalledApps()- } label: {- Label("Refresh", systemImage: "arrow.clockwise")- }- }+ }++ // MARK: - File Detail (right side)++ @ViewBuilder+ private var fileDetail: some View {+ if let app = appState.selectedApp {+ AppFilesView(app: app)+ } else {+ EmptyStateView(+ "Select an App",+ systemImage: "cursorarrow.click.2",+ description: "Select an app from the list to see all its related files across your system."+ )}}}