mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-05-29 05:38:06 +00:00
33 lines
886 B
Swift
33 lines
886 B
Swift
|
import Foundation
|
||
|
import SwiftUI
|
||
|
import Nuke
|
||
|
import NukeUI
|
||
|
import Models
|
||
|
|
||
|
@MainActor
|
||
|
extension Account {
|
||
|
public var displayNameWithEmojis: some View {
|
||
|
let splittedDisplayName = displayName.split(separator: ":")
|
||
|
return HStack(spacing: 0) {
|
||
|
ForEach(splittedDisplayName, id: \.self) { part in
|
||
|
if let emoji = emojis.first(where: { $0.shortcode == part }) {
|
||
|
LazyImage(url: emoji.url) { state in
|
||
|
if let image = state.image {
|
||
|
image
|
||
|
.resizingMode(.aspectFit)
|
||
|
} else if state.isLoading {
|
||
|
ProgressView()
|
||
|
} else {
|
||
|
ProgressView()
|
||
|
}
|
||
|
}
|
||
|
.processors([ImageProcessors.Resize(size: .init(width: 20, height: 20))])
|
||
|
.frame(width: 20, height: 20)
|
||
|
} else {
|
||
|
Text(part)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|