Referencing static method 'buildBlock' on 'Optional' requires that 'UIImage' conform to 'View'

I'm trying to make a mockup app to test my developing skills, i'm a mere beginner so I'm just using trial and error + tutorials to find my way through the solution and I can't get through this one, I'm thinking of using multiple Fan Francisco Icons so I may need a solution on how to insert an SF Icon ((I only know how to insert a Text or Image at the time))

Thanks in advice c:

Happy coding everybody!


//  ContentView.swift

//  -------------

//

//  Created by-------------- on 05/07/22.

//



import SwiftUI



struct ContentView: View {

    var body: some View {

        ZStack {                                       
//ERROR HERE: Referencing static method 'buildBlock' on 'Optional' requires that 'UIImage' conform to 'View'

            ScrollView {

                

            }

            

            VStack {

        HStack {

            

            Text("Razer Nari")

                .font(.system(size: 90, weight: .semibold, design: .default))

                .fontWeight(.bold)

                .foregroundColor(Color(hue: 0.322, saturation: 0.885, brightness: 0.799))

                .padding(.trailing)

                .frame(width: 320.0, height: 215.0)

                

            

            Image("razer")

                .resizable(resizingMode: .stretch)

                .aspectRatio(contentMode: .fit)

                .padding(.bottom)

                .frame(width: /*@START_MENU_TOKEN@*/120.0/*@END_MENU_TOKEN@*/, height: /*@START_MENU_TOKEN@*/120.0/*@END_MENU_TOKEN@*/)

                

            

            

                }

        

       

            

        

            

            Image("cuffie")

                .resizable()

                .aspectRatio(contentMode: .fit)

                .padding([.bottom, .trailing])

                .frame(width: 320.0, height: 300.0)

            

                

                Spacer()

                

    //ERROR OCCURRED WHEN TRYING TO USE A SF ICON, IDK IF IT'S THE CORRECT WAY TO USE THEM THO

        UIImage(systemName: "antenna.radiowaves.left.and.right")

               

                

                

                   

            }

            .frame(maxWidth:.infinity, maxHeight: .infinity)

            .background(Color(hue:0.0, saturation: 0.0 , brightness: 0.08 ))

            .foregroundColor(Color.white)

            

        }

            

        

        }

               

       

               

       

        

        

        

        

        

        

    }

    

  





struct ContentView_Previews: PreviewProvider {

    static var previews: some View {

        ContentView()

    }

}
Answered by szymczyk in 719473022

UIImage is part of the UIKit framework. You can't stick place an UIImage inside a SwiftUI view.

You used Image twice in your code. Is there a reason you can't use Image to show the SF Symbol? The following code works for me:

Image(systemName: "antenna.radiowaves.left.and.right")
Accepted Answer

UIImage is part of the UIKit framework. You can't stick place an UIImage inside a SwiftUI view.

You used Image twice in your code. Is there a reason you can't use Image to show the SF Symbol? The following code works for me:

Image(systemName: "antenna.radiowaves.left.and.right")
Referencing static method 'buildBlock' on 'Optional' requires that 'UIImage' conform to 'View'
 
 
Q