HomeiOS Developmentios - Easy methods to place SFSymbol inside Textual content SwiftUI View...

ios – Easy methods to place SFSymbol inside Textual content SwiftUI View together with String?


title must be a LocalizedStringKey. You may instantly use Pictures as a part of its string interpolation:

var title: LocalizedStringKey {
    swap self {
    case .verse:
        return "(Picture(systemName: "quote.opening")) verses"
    case .chapter:
        return "(Picture(systemName: "textual content.quote")) chapters"
    }
}

Now you do not even want your personal .localized. Observe that the localisation keys are %@ verses and %@ chapters, so change your xcstrings accordingly.


If you wish to use your personal .localized for some purpose (you actually should not), title may return a Textual content,

var title: Textual content {
    swap self {
    case .verse:
        return Textual content(Picture(systemName: "quote.opening")) + Textual content("verses".localized)
    case .chapter:
        return Textual content(Picture(systemName: "textual content.quote")) + Textual content("chapters".localized)
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments