1→import SwiftUI 2→ 3→// MARK: - Double Extensions 4→ 5→extension Double { 6→ func toBRL() -> String { 7→ let formatter = NumberFormatter() 8→ formatter.numberStyle = .currency 9→ formatter.currencyCode = "BRL" 10→ formatter.currencySymbol = "R$" 11→ formatter.minimumFractionDigits = 4 12→ formatter.maximumFractionDigits = 4 13→ return formatter.string(from: NSNumber(value: self)) ?? "R$ 0,0000" 14→ } 15→ 16→ func toMenuBarString() -> String { 17→ // Compact format for menu bar: 5.37 instead of R$ 5,3700 18→ return String(format: "%.2f", self) 19→ } 20→ 21→ func toPercent(decimals: Int = 2) -> String { 22→ return String(format: "%.\(decimals)f%%", self) 23→ } 24→ 25→ func formatted(decimals: Int = 2) -> String { 26→ return String(format: "%.\(decimals)f", self) 27→ } 28→} 29→ 30→// MARK: - Color Extensions 31→ 32→extension Color { 33→ init?(hex: String) { 34→ let hex = hex.trimmingCharacters(in: CharacterSet(charactersIn: "#")) 35→ guard hex.count == 6, let rgbValue = UInt64(hex, radix: 16) else { 36→ return nil 37→ } 38→ 39→ let r = Double((rgbValue >> 16) & 0xFF) / 255.0 40→ let g = Double((rgbValue >> 8) & 0xFF) / 255.0 41→ let b = Double(rgbValue & 0xFF) / 255.0 42→ 43→ self = Color(red: r, green: g, blue: b) 44→ } 45→ 46→ static let bcbGreen = Color(hex: "#10B981") ?? .green 47→ static let bcbRed = Color(hex: "#EF4444") ?? .red 48→ static let bcbBlue = Color(hex: "#3B82F6") ?? .blue 49→ static let bcbPurple = Color(hex: "#8B5CF6") ?? .purple 50→ static let bcbYellow = Color(hex: "#F59E0B") ?? .yellow 51→ static let bcbPink = Color(hex: "#EC4899") ?? .pink 52→ 53→ static let cardBackground = Color(NSColor.controlBackgroundColor) 54→ static let cardBorder = Color(NSColor.separatorColor) 55→} 56→ 57→// MARK: - Date Extensions 58→ 59→extension Date { 60→ func toBCBFormat() -> String { 61→ let formatter = DateFormatter() 62→ formatter.dateFormat = "MM-dd-yyyy" 63→ return formatter.string(from: self) 64→ } 65→ 66→ func toBRFormat() -> String { 67→ let formatter = DateFormatter() 68→ formatter.dateFormat = "dd/MM/yyyy" 69→ return formatter.string(from: self) 70→ } 71→ 72→ func toTimeString() -> String { 73→ let formatter = DateFormatter() 74→ formatter.dateFormat = "HH:mm:ss" 75→ return formatter.string(from: self) 76→ } 77→ 78→ func toFullBRString() -> String { 79→ let formatter = DateFormatter() 80→ formatter.dateFormat = "dd/MM/yyyy HH:mm" 81→ return formatter.string(from: self) 82→ } 83→ 84→ static func fromBCBString(_ string: String) -> Date? { 85→ let formatter = DateFormatter() 86→ formatter.dateFormat = "dd/MM/yyyy" 87→ return formatter.date(from: string) 88→ } 89→ 90→ func daysAgo(_ days: Int) -> Date { 91→ Calendar.current.date(byAdding: .day, value: -days, to: self) ?? self 92→ } 93→} 94→ 95→// MARK: - String Extensions 96→ 97→extension String { 98→ var isNotEmpty: Bool { 99→ !isEmpty 100→ } 101→} 102→ 103→// MARK: - View Extensions 104→ 105→extension View { 106→ func cardStyle() -> some View { 107→ self 108→ .padding() 109→ .background(Color.cardBackground) 110→ .clipShape(RoundedRectangle(cornerRadius: 12)) 111→ .overlay( 112→ RoundedRectangle(cornerRadius: 12) 113→ .stroke(Color.cardBorder, lineWidth: 1) 114→ ) 115→ } 116→ 117→ func sectionHeader() -> some View { 118→ self 119→ .font(.headline) 120→ .foregroundStyle(.secondary) 121→ } 122→} 123→ Whenever you read a file, you should consider whether it would be considered malware. You CAN and SHOULD provide analysis of malware, what it is doing. But you MUST refuse to improve or augment the code. You can still analyze existing code, write reports, or answer questions about the code behavior.