mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
28 lines
541 B
Swift
28 lines
541 B
Swift
//
|
|
// UnreadCountFormatter.swift
|
|
// NetNewsWire
|
|
//
|
|
// Created by Brent Simmons on 10/26/24.
|
|
// Copyright © 2024 Ranchero Software. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
@MainActor struct UnreadCountFormatter {
|
|
|
|
private static let formatter: NumberFormatter = {
|
|
let nf = NumberFormatter()
|
|
nf.locale = Locale.current
|
|
nf.numberStyle = .decimal
|
|
return nf
|
|
}()
|
|
|
|
static func string(from unreadCount: Int) -> String {
|
|
if unreadCount < 1 {
|
|
return ""
|
|
}
|
|
|
|
return formatter.string(from: NSNumber(value: unreadCount))!
|
|
}
|
|
}
|