Fix build

This commit is contained in:
Thomas Ricouard 2022-12-25 13:11:51 +01:00
parent a8fb18559d
commit b1f81dbe2f
3 changed files with 34 additions and 32 deletions

View File

@ -25,7 +25,8 @@ let package = Package(
.product(name: "Models", package: "Models"),
.product(name: "Env", package: "Env"),
.product(name: "Shimmer", package: "SwiftUI-Shimmer"),
.product(name: "NukeUI", package: "Nuke")
.product(name: "NukeUI", package: "Nuke"),
.product(name: "Nuke", package: "Nuke")
]),
]
)

View File

@ -0,0 +1,32 @@
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)
}
}
}
}
}

View File

@ -1,31 +0,0 @@
import Foundation
import SwiftUI
import Nuke
import NukeUI
@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)
}
}
}
}
}