IceCubesApp/Packages/DesignSystem/Sources/DesignSystem/AccountExt.swift
Thomas Ricouard 7f6419ebae Swiftformat
2023-01-17 11:36:01 +01:00

27 lines
586 B
Swift

import Foundation
import Models
import NukeUI
import SwiftUI
public extension Account {
private struct Part: Identifiable {
let id = UUID().uuidString
let value: Substring
}
var safeDisplayName: String {
if displayName.isEmpty {
return username
}
return displayName
}
var displayNameWithoutEmojis: String {
var name = safeDisplayName
for emoji in emojis {
name = name.replacingOccurrences(of: ":\(emoji.shortcode):", with: "")
}
return name.split(separator: " ", omittingEmptySubsequences: true).joined(separator: " ")
}
}