I am looking for a way to show an image from a database or storage. Assume that every user in my firebase has at least an email, password, uid, and profileImageUrl. my Code:
private var customNavBar: some View {
HStack(spacing: 16){
WebImage(url: URL(string: viewmodel.chatUser?.profileImageURL ?? ""))
.font(.system(size: 25))
.scaledToFill()
.frame(width: 50, height: 50)
.clipped()
.cornerRadius(50)
.overlay(RoundedRectangle(cornerRadius: 44)
.stroke(Color(.label), lineWidth: 1)
)
.shadow(radius: 5)
VStack(alignment: .leading, spacing: 4) {
Text("\(vm.chatUser?.email.replacingOccurrences(of: "@gmail.com", with: "" ) ?? "")").font(.system(size: 24, weight: .bold))
HStack{
Circle()
.foregroundColor(.green)
.frame(width: 14, height: 14)
Text("Online").font(.system(size: 12)).foregroundColor(Color(.lightGray))
}
}
if i take the URL from database cloud with AsyncImage() it works
AsyncImage(url: URL(string: "https://firebasestorage.googleapis.com:443/v0/b/chatapp-c27c9.appspot.com/o/iZIiznISh7cRQGQL6ZciUNKC7OD2?alt=media&token=e480366d-66cf-469e-8219-a8c02bfece3b%22))
but I need to access the this URL through swiftui and I don't know how I would be thankful if somebody enlight me