Post

Replies

Boosts

Views

Activity

Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
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)   } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
struct Home: View {   @EnvironmentObject var data : msgDatas   @State var show: Bool = false         var body : some View{           ZStack{               Color("bg").edgesIgnoringSafeArea(.top)               NavigationLink(destination: Chat(), isActive: self.$show) {                 Text("")       }       VStack{                   topView()       }     }   } } struct topView : View {       var body : some View{           VStack{               HStack(spacing: 15){                   Text("Chats").fontWeight(.heavy).font(.system(size: 23))                   Spacer()                   Button(action: {                     }) {                       Image(systemName: "magnifyingglass").resizable().frame(width: 20, height: 20)         }                   Button(action: {                     }) {                       Image("menu").resizable().frame(width: 20, height: 20)         }                 }       .foregroundColor(Color.white)       .padding()               GeometryReader{_ in                   Main().clipShape(Rounded())       }     }         } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
This project writen in SwiftUI 1.0, I want to convert to swiftUI 2.0 . it say ( Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in UIKitCore/UIView.h may also be helpful. Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(:) for msgDatas may be missing as an ancestor of this view.: file SwiftUI, line 0 Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(:) for msgDatas may be missing as an ancestor of this view.: file SwiftUI, line 0)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
here it is I gave some code about it: struct msgType : Identifiable {       var id : Int   var msg : String   var time : String   var msgs : String   var name : String   var pic : String } // I already made a sample data.... var msgs : [msgType] = [       msgType(id: 0, msg: "New Album Is Going To Be Released!!!!", time: "14:32", msgs: "2", name: "Taylor", pic: "p0")  ]
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
brother in all question u are just asking interesting question, but no any solution, pls I need help. it is clear question. SceneDelegate: class SceneDelegate: UIResponder, UIWindowSceneDelegate {   var window: UIWindow?   func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {     // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.     // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.     // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).     // Create the SwiftUI view that provides the window contents.     let contentView = ContentView()     let msgdata = msgDatas()          // Use a UIHostingController as window root view controller.     if let windowScene = scene as? UIWindowScene {       let window = UIWindow(windowScene: windowScene)       window.rootViewController = UIHostingController(rootView: contentView.environmentObject(msgdata))       self.window = window       window.makeKeyAndVisible()     }   }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
here it is, class msgDatas : ObservableObject{       @Published var show : Bool = false   @Published var selectedData : msgType = .init(id: -1, msg: "", time: "", msgs: "", name: "", pic: "") }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
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)   } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
struct Home: View {   @EnvironmentObject var data : msgDatas   @State var show: Bool = false         var body : some View{           ZStack{               Color("bg").edgesIgnoringSafeArea(.top)               NavigationLink(destination: Chat(), isActive: self.$show) {                 Text("")       }       VStack{                   topView()       }     }   } } struct topView : View {       var body : some View{           VStack{               HStack(spacing: 15){                   Text("Chats").fontWeight(.heavy).font(.system(size: 23))                   Spacer()                   Button(action: {                     }) {                       Image(systemName: "magnifyingglass").resizable().frame(width: 20, height: 20)         }                   Button(action: {                     }) {                       Image("menu").resizable().frame(width: 20, height: 20)         }                 }       .foregroundColor(Color.white)       .padding()               GeometryReader{_ in                   Main().clipShape(Rounded())       }     }         } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
I shown all
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
I have tab view inside a navigation view is crashing without any reason. its working without tab view seems to be bug....
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
This project writen in SwiftUI 1.0, I want to convert to swiftUI 2.0 . it say ( Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in UIKitCore/UIView.h may also be helpful. Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(:) for msgDatas may be missing as an ancestor of this view.: file SwiftUI, line 0 Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(:) for msgDatas may be missing as an ancestor of this view.: file SwiftUI, line 0)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
brother, it is work , when I click the chatcell, it throw error for " self.data.selectedData = i         self.data.show.toggle()"
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
here it is I gave some code about it: struct msgType : Identifiable {       var id : Int   var msg : String   var time : String   var msgs : String   var name : String   var pic : String } // I already made a sample data.... var msgs : [msgType] = [       msgType(id: 0, msg: "New Album Is Going To Be Released!!!!", time: "14:32", msgs: "2", name: "Taylor", pic: "p0")  ]
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
I show all code, u are not intend to solve problems.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
brother in all question u are just asking interesting question, but no any solution, pls I need help. it is clear question. SceneDelegate: class SceneDelegate: UIResponder, UIWindowSceneDelegate {   var window: UIWindow?   func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {     // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.     // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.     // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).     // Create the SwiftUI view that provides the window contents.     let contentView = ContentView()     let msgdata = msgDatas()          // Use a UIHostingController as window root view controller.     if let windowScene = scene as? UIWindowScene {       let window = UIWindow(windowScene: windowScene)       window.rootViewController = UIHostingController(rootView: contentView.environmentObject(msgdata))       self.window = window       window.makeKeyAndVisible()     }   }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
I did not get it what u mean?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’21