How to use specific symbol of SVG in iOS swift?

I've download google SVG file and droped to xcode and I can see

enter image description here

The name of the reasource is search and I used in UIButton as button.setImage(UIImage(named: "search")!, for: .normal) which works fine.

But I want to use Medium-Light image. I am not sure how could I use, I tried search-medium-light but It crashes. Is there a way to use it?


  • The different sizes and scales form part of the UIImage.SymbolConfiguration, which you should use when creating the image:

    let configuration = UIImage.SymbolConfiguration(weight: .light)
        .applying(UIImage.SymbolConfiguration(scale: .medium))
    let image = UIImage(named: "search", in: nil, with: configuration)