Xcode 13 - Swift compile error

Dear community,

Yesterday I update Xcode from 12.5.1 to 13.0 and I came across a lot of compile error. Until before the update all was working great, but I suppose probably some syntax rules changes with the update for iOS 15.

 .background(Color.systemBlue)

error: Type 'Color' has no member 'systemBlue'
 .maxWidth(.infinity)

error: 
Cannot infer contextual base in reference to member 'infinity'
Value of type 'Image' has no member 'maxWidth'

.aspectRatio(contentMode: .fit)

error: Cannot infer contextual base in reference to member 'fit'
 Image(.system("line.horizontal.3.circle.fill"))

error: Type 'String' has no member 'system'
.font(.largeTitle, weight: .bold)

errors: 

- Cannot infer contextual base in reference to member 'bold'
- Extra argument 'weight' in call

 Image(section.logo)
       .resizable()
       .height(32)

error: Value of type 'Image' has no member 'height'
Command CompileSwift failed with a nonzero exit code

I hope that this one will fix by itself

Basically I got 23 errors... and the code before yesterday was working great.

Thanks to those who will help me, hoping it will be useful to other users,

Martin

Answered by Claude31 in 690196022

Is it SwiftUI ?

I tested in both Xcode 12.5 and 12.4

 .background(Color.systemBlue)

In both cases I get the error:

error: Type 'Color' has no member 'systemBlue'

So could you post more code and confirm if it is SwiftUI code ?

Accepted Answer

Is it SwiftUI ?

I tested in both Xcode 12.5 and 12.4

 .background(Color.systemBlue)

In both cases I get the error:

error: Type 'Color' has no member 'systemBlue'

So could you post more code and confirm if it is SwiftUI code ?

HStack {

     Image(.system("line.horizontal.3.circle.fill"))  // error

                        .font(.largeTitle, weight: .bold).     // error

                        .foregroundColor(.primary)

                        .onTapGesture {

                            self.showsettings.toggle()

                    }

                    

                    

                    Text("Explore")

                       .font(.largeTitle, weight: .bold)    // error

                        .padding(.leading,20)

                    Spacer()

                    

                    Button(action: {self.showGuide.toggle()}) {

                        Image(.system("questionmark"))  //error

                        .foregroundColor(.white)

                        .font(.system(size: 16, weight: .medium))

                        .frame(width: 42, height: 42)

                        .clipShape(Circle())

                         } .padding(.trailing,20)

                    
  .sheet(isPresented: self.$showGuide, content: {

                        GuideView()

                    })

                 
                 }
Xcode 13 - Swift compile error
 
 
Q