Skip to content

Add text styling to parts of Text in SwiftUI using string interpolation.

Notifications You must be signed in to change notification settings

Tylerc230/TextyText

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TextyText for SwiftUI

A micro framework that adds text style interpolation to Text views. With this framework, text style (color, font, weight etc) can be added to parts of a string using string interpolation. Some examples:

Text("Hi, I'm \("red", color: .red)")
Text("I'm a \("title", font: .title) text")
Text("Hi, I'm \("bold", bold: true)")

It is even possible to pass in a transform function of the form (Text) -> Text

Text("Now I'm \("blue and italic", blueItalic(_:))")
func blueItalic(_ text: Text) -> Text {
    text
        .foregroundColor(.blue)
        .italic()
}

About

Add text styling to parts of Text in SwiftUI using string interpolation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages