Files
aris-old/IrisCompanion/iris/Models/WinnerEnvelope.swift

24 lines
556 B
Swift
Raw Permalink Normal View History

2026-01-08 19:16:32 +00:00
//
// WinnerEnvelope.swift
// iris
//
// Created by Codex.
//
import Foundation
enum TextConstraints {
static let titleMax = 26
static let subtitleMax = 30
static let ellipsis = "..."
}
extension String {
func truncated(maxLength: Int) -> String {
guard count > maxLength else { return self }
let ellipsisCount = TextConstraints.ellipsis.count
guard maxLength > ellipsisCount else { return String(prefix(maxLength)) }
return String(prefix(maxLength - ellipsisCount)) + TextConstraints.ellipsis
}
}