Xcode 12 beta problem

Hi everyone! I just recently downloaded Xcode 12 beta and have updated to Mac OS Big Sur. When I open my project I keep getting “no such module” errors! There aren’t any errors within the code itself as it was running perfectly before the update. Not sure what to do… I can’t seem to find anything about it on google and I’ve tried uninstalling and re-installing pods… Any ideas? I’m apologising in advance if its something obvious.
Spike :slight_smile:

Try cleaning your build folder using the keyboard combination Shift + Option + Command + K and then do a build Command + B.

Still no result :confused: for some reason it doesn’t like anything like FBSDKLoginKit, FirebaseAuth, FirebaseFirestore etc

For some reason it manages to work now! Only difference was I opened the .workspace file instead of opening it from the Xcode menu!!! Thanks

Also you should download Xcode 12, NOT beta, because it’s not in beta anymore

That’s a bit of a trap with pod installations.

One thing for sure now is that you will always remember to open the .xcworkspace file in preference to the .xcodeproj file.

So Im back on Xcode 12, everything builds normally BUT… I can’t get the preview to work now. Each time I build the app I get this diagnostic.


The preview process appears to have crashed.

Error encountered when sending 'previewInstances' message to agent.

==================================

|  RemoteHumanReadableError: The operation couldn’t be completed. (BSServiceConnectionErrorDomain error 3.)
|  
|  BSServiceConnectionErrorDomain (3):
|  ==BSErrorCodeDescription: OperationFailed

Ive had a good search and seems to be a common problem but I can’t really find a solution anywhere! Any ideas?

Is your preview code basic like this:

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

or a little more complex to suit the App you have created?

yep, exactly the same!

That’s a bit odd. I wonder if the issue is related to your version of Mac OS Big Sur.

I’ve no idea… If I open a new project and build something small and random it works there… but for some reason once there is a decent amount of code, it picks and chooses what it likes.
For example something like this won’t run in preview:

struct ContentView: View {
      var body: some View {
  
          // Type 1
          NavigationView{
              
              Home()
          }
      }
  }
  
  struct ContentView_Previews: PreviewProvider {
      static var previews: some View {
          ContentView()
      }
  }
  
  struct Home : View {
      
      @State var selectedTab = "Home"
      var edges = UIApplication.shared.windows.first?.safeAreaInsets
      @Namespace var animation
      @StateObject var modelData = ModelView()
      
      var body: some View{
          
          VStack(spacing: 0){
              
              GeometryReader{_ in
                  
                  ZStack{
                      
                      // Tabs....
                      
                      // Type 2
                      //NavigationView{
                          
                          ScrollView{
                              
                              ForEach(1...25,id: \.self){i in
                                  
                                  NavigationLink(destination: Text("Home Data \(i)")) {
                                      
                                      VStack(alignment: .leading){
                                          
                                          Text("Home Data \(i)")
                                              .padding()
                                              .foregroundColor(.black)
                                          
                                          Divider()
                                      }
                                  }
                              }
                              .padding(.bottom)
                          //}
                          .navigationBarHidden(true)
                      }
                      .opacity(selectedTab == "Home" ? 1 : 0)
                      
                      Text("Restaurants")
                          .opacity(selectedTab == "Restaurants" ? 1 : 0)
                      
                      Text("Orders")
                          .opacity(selectedTab == "Orders" ? 1 : 0)
                      
                      Text("Rewards")
                          .opacity(selectedTab == "Rewards" ? 1 : 0)
                  }
              }
              .onChange(of: selectedTab) { (_) in
                  
                  switch(selectedTab){
                  
                  case "Restaurants": if !modelData.isRestaurantLoad{modelData.loadRestaurant()}
                  case "Orders": if !modelData.isOrderLoad{modelData.loadOrders()}
                  case "Rewards": if !modelData.isRewardLoad{modelData.loadReward()}
                  default: ()
                  }
              }
              
              // TabView...
              
              HStack(spacing: 0){
                  
                  ForEach(tabs,id: \.self){tab in
                      
                      TabButton(title: tab, selectedTab: $selectedTab,animation: animation)
                      
                      if tab != tabs.last{
                          Spacer(minLength: 0)
                      }
                  }
              }
              .padding(.horizontal,30)
              // for iphone like 8 and SE
              .padding(.bottom,edges!.bottom == 0 ? 15 : edges!.bottom)
              .background(Color.white)
          }
          .ignoresSafeArea(.all, edges: .bottom)
          .background(Color.black.opacity(0.06).ignoresSafeArea(.all, edges: .all))
      }
  }
  
  // Tab Button...
  
  struct TabButton : View {
      
      var title : String
      @Binding var selectedTab : String
      var animation : Namespace.ID
      
      var body: some View{
          
          Button(action: {
              withAnimation{selectedTab = title}
          }) {
              
              VStack(spacing: 6){
                  
                  // Top Indicator....
                  
                  // Custom Shape...
                  
                  // Slide in and out animation...
                  
                  ZStack{
                      
                      CustomShape()
                          .fill(Color.clear)
                          .frame(width: 45, height: 6)
                      
                      if selectedTab == title{
                          
                          CustomShape()
                              .fill(Color("tint"))
                              .frame(width: 45, height: 6)
                              .matchedGeometryEffect(id: "Tab_Change", in: animation)
                      }
                  }
                  .padding(.bottom,10)
                  
                  Image(title)
                      .renderingMode(.template)
                      .resizable()
                      .foregroundColor(selectedTab == title ? Color("tint") : Color.black.opacity(0.2))
                      .frame(width: 24, height: 24)
                  
                  Text(title)
                      .font(.caption)
                      .fontWeight(.bold)
                      .foregroundColor(Color.black.opacity(selectedTab == title ? 0.6 : 0.2))
              }
          }
      }
  }
  
  // Custom Shape..
  
  struct CustomShape: Shape {
      
      func path(in rect: CGRect) -> Path {
          
          let path = UIBezierPath(roundedRect: rect, byRoundingCorners: [.bottomLeft,.bottomRight], cornerRadii: CGSize(width: 10, height: 10))
          
          return Path(path.cgPath)
      }
  }
  
  // Both Title Image Name Are Same....
  var tabs = ["Home","Restaurants","Orders","Rewards"]
  
  // if You Having simply views and not that much network task means its fine
  // else use this method to load data when the tab opens....
  
  class ModelView : ObservableObject{
      
      @Published var isOrderLoad = false
      @Published var isRestaurantLoad = false
      @Published var isRewardLoad = false
      
      init() {
          
          // load initial data
          print("Home Data Loaded")
      }
      
      func loadOrders(){
          
          print("order Loaded")
          isOrderLoad = true
      }
      
      func loadRestaurant(){
          
          print("Restaurant Loaded")
          isRestaurantLoad = true
      }
      
      func loadReward(){
          
          print("reward Loaded")
          isRewardLoad = true
      }
  }

BUT this will run in preview:

struct ContentView: View {
      var body: some View {
          
          ZStack{
              
              LinearGradient(gradient: .init(colors: [Color("Color"),Color("Color1"),Color("Color2")]), startPoint: .top, endPoint: .bottom).edgesIgnoringSafeArea(.all)
              
              if UIScreen.main.bounds.height > 800{
                  
                  Home()
              }
              else{
                  
                  ScrollView(.vertical, showsIndicators: false) {
                      
                      Home()
                  }
              }
          }
      }
  }
  
  struct ContentView_Previews: PreviewProvider {
      static var previews: some View {
          ContentView()
      }
  }
  
  struct Home : View {
      
      @State var index = 0
      
      var body : some View{
          
          VStack{
              
              Image("logo")
              .resizable()
              .frame(width: 200, height: 180)
              
              HStack{
                  
                  Button(action: {
                      
                      withAnimation(.spring(response: 0.8, dampingFraction: 0.5, blendDuration: 0.5)){
                          
                         self.index = 0
                      }
                      
                  }) {
                      
                      Text("Existing")
                          .foregroundColor(self.index == 0 ? .black : .white)
                          .fontWeight(.bold)
                          .padding(.vertical, 10)
                          .frame(width: (UIScreen.main.bounds.width - 50) / 2)
                      
                  }.background(self.index == 0 ? Color.white : Color.clear)
                  .clipShape(Capsule())
                  
                  Button(action: {
                      
                     withAnimation(.spring(response: 0.8, dampingFraction: 0.5, blendDuration: 0.5)){
                         
                        self.index = 1
                     }
                      
                  }) {
                      
                      Text("New")
                          .foregroundColor(self.index == 1 ? .black : .white)
                          .fontWeight(.bold)
                          .padding(.vertical, 10)
                          .frame(width: (UIScreen.main.bounds.width - 50) / 2)
                      
                  }.background(self.index == 1 ? Color.white : Color.clear)
                  .clipShape(Capsule())
                  
              }.background(Color.black.opacity(0.1))
              .clipShape(Capsule())
              .padding(.top, 25)
              
              if self.index == 0{
                  
                  Login()
              }
              else{
                  
                  SignUp()
              }
              
              if self.index == 0{
                  
                  Button(action: {
                      
                  }) {
                      
                      Text("Forget Password?")
                          .foregroundColor(.white)
                  
                  }
                  .padding(.top, 20)
              }
              
              HStack(spacing: 15){
                  
                  Color.white.opacity(0.7)
                  .frame(width: 35, height: 1)
                  
                  Text("Or")
                      .fontWeight(.bold)
                      .foregroundColor(.white)
                  
                  Color.white.opacity(0.7)
                  .frame(width: 35, height: 1)
                  
              }
              .padding(.top, 10)
              
              HStack{
                  
                  Button(action: {
                      
                  }) {
                      
                      Image("fb")
                          .renderingMode(.original)
                          .padding()
                      
                  }.background(Color.white)
                  .clipShape(Circle())
                  
                  Button(action: {
                      
                  }) {
                      
                      Image("google")
                          .renderingMode(.original)
                          .padding()
                      
                  }.background(Color.white)
                  .clipShape(Circle())
                  .padding(.leading, 25)
              }
              .padding(.top, 10)
              
          }
          .padding()
      }
  }
  
  struct Login : View {
      
      @State var mail = ""
      @State var pass = ""
      
      var body : some View{
          
          VStack{
              
              VStack{
                  
                  HStack(spacing: 15){
                      
                      Image(systemName: "envelope")
                          .foregroundColor(.black)
                      
                      TextField("Enter Email Address", text: self.$mail)
                      
                  }.padding(.vertical, 20)
                  
                  Divider()
                  
                  HStack(spacing: 15){
                      
                      Image(systemName: "lock")
                      .resizable()
                      .frame(width: 15, height: 18)
                      .foregroundColor(.black)
                      
                      SecureField("Password", text: self.$pass)
                      
                      Button(action: {
                          
                      }) {
                          
                          Image(systemName: "eye")
                              .foregroundColor(.black)
                      }
                      
                  }.padding(.vertical, 20)
                  
              }
              .padding(.vertical)
              .padding(.horizontal, 20)
              .padding(.bottom, 40)
              .background(Color.white)
              .cornerRadius(10)
              .padding(.top, 25)
              
              
              Button(action: {
                  
              }) {
                  
                  Text("LOGIN")
                      .foregroundColor(.white)
                      .fontWeight(.bold)
                      .padding(.vertical)
                      .frame(width: UIScreen.main.bounds.width - 100)
                  
              }.background(
              
                  LinearGradient(gradient: .init(colors: [Color("Color2"),Color("Color1"),Color("Color")]), startPoint: .leading, endPoint: .trailing)
              )
              .cornerRadius(8)
              .offset(y: -40)
              .padding(.bottom, -40)
              .shadow(radius: 15)
          }
      }
  }
  
  struct SignUp : View {
      
      @State var mail = ""
      @State var pass = ""
      @State var repass = ""
      
      var body : some View{
          
          VStack{
              
              VStack{
                  
                  HStack(spacing: 15){
                      
                      Image(systemName: "envelope")
                          .foregroundColor(.black)
                      
                      TextField("Enter Email Address", text: self.$mail)
                      
                  }.padding(.vertical, 20)
                  
                  Divider()
                  
                  HStack(spacing: 15){
                      
                      Image(systemName: "lock")
                      .resizable()
                      .frame(width: 15, height: 18)
                      .foregroundColor(.black)
                      
                      SecureField("Password", text: self.$pass)
                      
                      Button(action: {
                          
                      }) {
                          
                          Image(systemName: "eye")
                              .foregroundColor(.black)
                      }
                      
                  }.padding(.vertical, 20)
                  
                  Divider()
                  
                  HStack(spacing: 15){
                      
                      Image(systemName: "lock")
                      .resizable()
                      .frame(width: 15, height: 18)
                      .foregroundColor(.black)
                      
                      SecureField("Re-Enter", text: self.$repass)
                      
                      Button(action: {
                          
                      }) {
                          
                          Image(systemName: "eye")
                              .foregroundColor(.black)
                      }
                      
                  }.padding(.vertical, 20)
                  
              }
              .padding(.vertical)
              .padding(.horizontal, 20)
              .padding(.bottom, 40)
              .background(Color.white)
              .cornerRadius(10)
              .padding(.top, 25)
              
              
              Button(action: {
                  
              }) {
                  
                  Text("SIGNUP")
                      .foregroundColor(.white)
                      .fontWeight(.bold)
                      .padding(.vertical)
                      .frame(width: UIScreen.main.bounds.width - 100)
                  
              }.background(
              
                  LinearGradient(gradient: .init(colors: [Color("Color2"),Color("Color1"),Color("Color")]), startPoint: .leading, endPoint: .trailing)
              )
              .cornerRadius(8)
              .offset(y: -40)
              .padding(.bottom, -40)
              .shadow(radius: 15)
          }
      }
  }

Just want to throw my laptop out the window haha! :slightly_smiling_face: :face_with_raised_eyebrow: :neutral_face: :expressionless: :frowning_face: :triumph: :face_with_symbols_over_mouth:

As a matter of interest, what do your image assets consist of?
Home
Restaurants
Orders
Rewards

Just some png files… I just create say a 128x128 image in illustrator then export 2x and 3x png’s