Files
ichmagmaus111andClaude Opus 5.5 0622057a4f Ghostgram: open-source release
Ghostgram for iOS, rebuilt from scratch on Telegram iOS 13.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 17:57:09 +01:00

28 lines
968 B
Swift

import Foundation
/// What the header of an expandable row without a master switch (`GGMenuRowKind.expandableList`)
/// sums up: how many of its visible children are on. Foundation only: host-tested.
public struct GGMenuGroupCount: Equatable {
public let selected: Int
public let total: Int
public init(selected: Int, total: Int) {
self.selected = selected
self.total = total
}
/// The values of the visible children, in any order.
public init(values: [Bool]) {
self.init(selected: values.filter { $0 }.count, total: values.count)
}
/// The text on the right of the header: nil while no child is on («пусто, если ничего не
/// выбрано»), otherwise the feature's own wording («скрыто: 2 из 4»).
public func summary(_ text: (GGMenuGroupCount) -> String) -> String? {
if self.selected == 0 {
return nil
}
return text(self)
}
}