mirror of
https://github.com/Cocoanetics/SwiftMail.git
synced 2026-03-17 20:02:25 +00:00
23 lines
694 B
Swift
23 lines
694 B
Swift
// Email+CustomStringConvertible.swift
|
|
// CustomStringConvertible extension for Email
|
|
|
|
import Foundation
|
|
|
|
// Standard description - simple and concise
|
|
extension Message: CustomStringConvertible {
|
|
public var description: String {
|
|
return "Email #\(sequenceNumber) | \(subject.truncated(maxLength: 50)) | From: \(from.truncated(maxLength: 30))"
|
|
}
|
|
}
|
|
|
|
// Helper extension to truncate strings for display
|
|
private extension String {
|
|
func truncated(maxLength: Int) -> String {
|
|
if self.count <= maxLength {
|
|
return self
|
|
}
|
|
let endIndex = self.index(self.startIndex, offsetBy: maxLength - 3)
|
|
return String(self[..<endIndex]) + "..."
|
|
}
|
|
}
|