From 55bf5bbc2c96cdf33949c46f8ab002c68a614d6d Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 22 May 2026 23:48:10 -0700 Subject: [PATCH] Fix SwiftUI Section builders for Swift 6 compatibility --- SwiftCode/Views/Collaboration/PRCreateView.swift | 9 ++++++--- .../Developer/DeploymentDebug/DeploymentDebugView.swift | 9 ++++++--- SwiftCode/Views/Utilities/FilePreviewView.swift | 9 +++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/SwiftCode/Views/Collaboration/PRCreateView.swift b/SwiftCode/Views/Collaboration/PRCreateView.swift index 9fb3060..3c56134 100644 --- a/SwiftCode/Views/Collaboration/PRCreateView.swift +++ b/SwiftCode/Views/Collaboration/PRCreateView.swift @@ -57,12 +57,11 @@ struct PRCreateView: View { } Section("Commits Included") { - let commits = manager.commits.commits(for: sourceBranchID) - if commits.isEmpty { + if sourceBranchCommits.isEmpty { Text("No commits on source branch.") .foregroundStyle(.secondary) } - ForEach(commits) { commit in + ForEach(sourceBranchCommits) { commit in PRCommitSelectionRow(title: commit.message, subtitle: "\(commit.authorID)", isSelected: selectedCommitIDs.contains(commit.id)) { if selectedCommitIDs.contains(commit.id) { selectedCommitIDs.remove(commit.id) @@ -135,6 +134,10 @@ struct PRCreateView: View { errorMessage = "Select at least one commit or enable Empty Pull Request." } } + + private var sourceBranchCommits: [CollaborationCommit] { + manager.commits.commits(for: sourceBranchID) + } } private struct PRCommitSelectionRow: View { diff --git a/SwiftCode/Views/Developer/DeploymentDebug/DeploymentDebugView.swift b/SwiftCode/Views/Developer/DeploymentDebug/DeploymentDebugView.swift index be692b9..da0645e 100644 --- a/SwiftCode/Views/Developer/DeploymentDebug/DeploymentDebugView.swift +++ b/SwiftCode/Views/Developer/DeploymentDebug/DeploymentDebugView.swift @@ -15,11 +15,10 @@ struct DeploymentDebugView: View { } Section("Deployment History") { - let logs = logger.logs.filter { $0.category == .deployments } - if logs.isEmpty { + if deploymentLogs.isEmpty { Text("No deployment logs").foregroundColor(.secondary) } else { - ForEach(logs) { log in + ForEach(deploymentLogs) { log in VStack(alignment: .leading) { Text(log.message) .font(.caption) @@ -33,4 +32,8 @@ struct DeploymentDebugView: View { } .navigationTitle("Deployment Debug") } + + private var deploymentLogs: [LogEntry] { + logger.logs.filter { $0.category == .deployments } + } } diff --git a/SwiftCode/Views/Utilities/FilePreviewView.swift b/SwiftCode/Views/Utilities/FilePreviewView.swift index b9c98cf..8d987ea 100644 --- a/SwiftCode/Views/Utilities/FilePreviewView.swift +++ b/SwiftCode/Views/Utilities/FilePreviewView.swift @@ -163,10 +163,11 @@ struct FilePreviewView: View { } } Section("Content") { - let size = rawText.count - infoRow(label: "Characters", value: "\(size)") - infoRow(label: "Lines", value: "\(rawText.components(separatedBy: "\n").count)") - infoRow(label: "Words", value: "\(rawText.components(separatedBy: .whitespacesAndNewlines).filter { !$0.isEmpty }.count)") + Group { + infoRow(label: "Characters", value: "\(rawText.count)") + infoRow(label: "Lines", value: "\(rawText.components(separatedBy: "\n").count)") + infoRow(label: "Words", value: "\(rawText.components(separatedBy: .whitespacesAndNewlines).filter { !$0.isEmpty }.count)") + } } } .listStyle(.insetGrouped)