struct chatTopview : View {
@EnvironmentObject var data : msgDatas
@State var show: Bool = false
var body : some View{
HStack(spacing : 15){
Button(action: {
self.data.show.toggle()
}) {
Image(systemName: "control").font(.title).rotationEffect(.init(degrees: -90))
}
Spacer()
VStack(spacing: 5){
Image(data.selectedData.pic).resizable().frame(width: 45, height: 45).clipShape(Circle())
Text(data.selectedData.name).fontWeight(.heavy)
}.offset(x: 25)
Spacer()
Button(action: {
}) {
Image(systemName: "phone.fill").resizable().frame(width: 20, height: 20)
}.padding(.trailing, 25)
Button(action: {
}) {
Image(systemName: "video.fill").resizable().frame(width: 23, height: 16)
}
}.foregroundColor(.white)
.padding()
}
}
and chatCell:
struct chatCell : View {
var data : msgdataType
var body : some View{
HStack{
if data.myMsg{
Spacer()
Text(data.msg)
.padding()
.background(Color("bg"))
.clipShape(msgTail(mymsg: data.myMsg))
.foregroundColor(.white)
}
else{
Text(data.msg)
.padding()
.background(Color("txtbox"))
.clipShape(msgTail(mymsg: data.myMsg))
Spacer()
}
}.padding(data.myMsg ? .leading : .trailing, 55)
.padding(.vertical,10)
}
}