ternary operator with sf symbol?

Hi there, I am new to SwiftUI, is it possible to use ternary operator with sf symbol, like this? I tried this code, but it got an error.

Button(action: toggleLocalSession) {
                        Image(isLocalInSession ? (systemName: "x.circle.fill") : (systemName: "video.circle.fill"))
                    }.frame(width: 70, height: 70)

This is the error message.

Cannot convert value of type '(systemName: String)' to expected argument type 'String'

Thanks a lot for your help!

Do it this way instead:

Image(systemName: isLocalInSession ? "x.circle.fill" : "video.circle.fill")
Terms of Service

Privacy Policy

Cookie Policy