No force unwrapping (!) or force casting (as!) anywhere in the codebase. Use safe alternatives:
// Goodguard let response = transaction.response else { Self.logger.warning("Transaction has no response") return}if let contentType = headers["Content-Type"] as? String { detectFormat(contentType)}// Bad — will crash on nillet response = transaction.response!let contentType = headers["Content-Type"] as! String
Use String(localized:) for all user-facing strings in non-SwiftUI code:
let message = String(localized: "proxy.started.message")
SwiftUI view literals auto-localize — Text("Start Proxy") and Button("Clear Session") are automatically looked up in the strings catalog. Do not wrap these in String(localized:).Do not localize technical terms (HTTP, TLS, WebSocket, GraphQL, etc.).
Do not add comments that restate what the code already says. Only comment to explain non-obvious reasoning:
// Bad — restates the code// Check if the transaction has a responseguard let response = transaction.response else { return }// Good — explains the "why"// NIO delivers chunks out of order under back-pressure;// reassemble by sequence number before forwardingchunks.sort(by: \.sequenceNumber)
When approaching these limits, extract logic into extension files following the MainContentCoordinator pattern — e.g., TypeName+Category.swift. Group by domain logic, not arbitrary line counts.