I updated Xcode to 11.4 today and immediately found unexpectd behavior. Below is a simple view to display all messages in a chat room. When a new message is downloaded from server, the list refreshed automatically to display it. But with Xcode 11.4 and ios 13.4, with a 50:50 chance, a new chat room view will (unexpectly) pop up and all rows behave abnormally. Is there anybody experiencing the same? My code below:
import SwiftUI
struct ChatRoomDetailView: View {
@EnvironmentObject var userData: UserData
@State var messageText: String = ""
@State var isShowingGroupOperation = false
var displayChatRoom: ChatRoom
var thisRoomtitle: String {
if displayChatRoom.isPrivate {
if (displayChatRoom.creatorId == userData.currentUser.name) {return userData.friendNickNames[displayChatRoom.otherUser] ?? displayChatRoom.chatRoomTitle} else {return userData.friendNickNames[displayChatRoom.creatorId] ?? displayChatRoom.chatRoomTitle}
} else {return displayChatRoom.chatRoomTitle}
}
func findIndex(chatRoomId: Int) -> Int {
for (index, value) in userData.chatRooms.enumerated() {
if (value.id == chatRoomId) {return index}
}
return 0
}
var body: some View {
KeyboardHost {
VStack {
List {
ForEach(self.displayChatRoom.messages) {message in
HStack{
if (message.senderId == self.userData.currentUser.name) {
SelfMessageLine(message: message)
} else {OtherMessageLine(message: message)}
}
}
.onDelete {indexSet in
self.userData.deleteMessage(displayChatRoomId: self.displayChatRoom.id, id: self.displayChatRoom.messages[indexSet.sorted()[0]].id)
}
}
......