Skip to content

Instantly share code, notes, and snippets.

@saroar
Created October 26, 2020 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saroar/3a63874e68b41752e726928fb15b2c8c to your computer and use it in GitHub Desktop.
Save saroar/3a63874e68b41752e726928fb15b2c8c to your computer and use it in GitHub Desktop.
var body: some View {
Group {
if !currenuser(chatMessageResponse.sender.id) {
HStack {
Group {
AsyncImage(
avatarLink: chatMessageResponse.sender.avatarUrl,
placeholder: Text("Loading ..."),
cache: self.cache, configuration: {
$0.resizable()
}
)
.aspectRatio(contentMode: .fit)
.frame(width: 40, height: 40)
.clipShape(Circle())
Text(chatMessageResponse.messageBody)
.bold()
.padding(10)
.foregroundColor(Color.white)
.background(Color.blue)
.cornerRadius(10)
}
.background(colorScheme == .dark ? Color.black : Color.white)
Spacer()
}
.background(colorScheme == .dark ? Color.black : Color.white)
} else {
HStack {
Group {
Spacer()
Text(chatMessageResponse.messageBody)
.bold()
.foregroundColor(Color.white)
.padding(10)
.background(Color.red)
.cornerRadius(10)
AsyncImage(
avatarLink: chatMessageResponse.sender.avatarUrl,
placeholder: Text("Loading ..."), cache: self.cache,
configuration: {
$0.resizable()
}
)
.aspectRatio(contentMode: .fit)
.frame(width: 40, height: 40)
.clipShape(Circle())
}
}
.background(colorScheme == .dark ? Color.black : Color.white)
}
}
.background(colorScheme == .dark ? Color.black : Color.white)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment