Post

Replies

Boosts

Views

Activity

Xcode 11.4 Unexpected behavior
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 SwiftUIstruct 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) } }......
0
0
431
Mar ’20
In SwiftUI, how to hide tab bar when a list is tapped to show a new view (without the tab bar)?
This List in the first page of a tab view. When a cell is tapped, I want to show a new ChatRoomDetail view and hide tab bar. But I couldn't find a way in documentation. How should I do it? Thanks!struct ChatList: View { @State var showChatRoomDetail: Bool = false var items: [ChatRoom] var body: some View { NavigationView { List { ForEach(self.items) { item in NavigationLink(destination: ChatRoomDetail(currentMessage: "", chatRoom: item)){ Text(item.titleString) } } }
7
0
10k
Oct ’19