HighlightSwift icon indicating copy to clipboard operation
HighlightSwift copied to clipboard

Added `.codeFont(_:)` modifier

Open blsage opened this issue 1 year ago • 1 comments

Updated modifiers to support a .codeFont(_:) custom attribute. Disabled monospaced design if font is set custom.

blsage avatar Oct 29 '24 06:10 blsage

These changes are well implemented, however I think they might be redundant.

Standard SwiftUI view modifiers can be applied to CodeText to override the font design back to .default and then set the font to one of the environment-dependent Font options. Notably, the order of these two modifiers does matter. For example:

struct HeadlineCodeText: View {
    let text: String

    var body: some View {
        CodeText(text)
            .fontDesign(.default)
            .font(.headline)
    }
}

Let me know if this is sufficient for your use case. If not, we could still consider merging this.

appstefan avatar Nov 27 '24 18:11 appstefan