How to setup, or how to send Avatar Image from url ?
- Dominant language
- Swift
- Stars
- 4.6k
- Forks
- 588
- PR merge metrics
- No merged PRs in 30d
Description
I have issues, sending the avatar image into the MessageViewModel.
I have followed the demo example
public func createViewModel(_ textMessage: DemoTextMessageModel) -> DemoTextMessageViewModel {
let messageViewModel = self.messageViewModelBuilder.createMessageViewModel(textMessage)
let textMessageViewModel = DemoTextMessageViewModel(textMessage: textMessage, messageViewModel: messageViewModel)
textMessageViewModel.avatarImage.value = UIImage(named: "userAvatar")
return textMessageViewModel
}
and created similar func, where i load the images it depends of the incoming or not a try to load the image, but dont know how to send the image/ or the image url
if textMessageViewModel.isIncoming {
textMessageViewModel.avatarImage.value = UIImage(named: "default_profile_picture")
} else {
DispatchQueue.global().async {
let data = try? Data(contentsOf: url!) // here i load the url
DispatchQueue.main.async {
textMessageViewModel.avatarImage.value = UIImage(data: data!)
}
}
}
so any ideas how to send the URL or how to send UIImage direct ? any examples that can help me ?
Contributor guide
Research direction
Start with the demo createViewModel function and the avatarImage assignment shown in the issue. Check how Chatto's MessageViewModel exposes avatar images and whether the documented example supports a UIImage or a URL; done means providing a clear usage example or documenting the supported approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100