I have an array of words. I need to display them on multiple lines, several words per line, each word using a different letter size. The letter size for each word will to be determined programatically. A familiar example would be one of those word frequency displays that shows the most common words in the largest size. Can I make that kind of display with swiftUI?
From the documentation of 'Text' I don't see a way to specify a numerical size, just a style such as.title. I understand that specifying a numerical font size may not be device-independent, but how else can I make the display that I'm looking for? Can I programmatically define a font style with a parameterized size so I can specify it numerically for each separate word? How do I do that?
You can specify the size of text like this
Text("hello")
.font(.system(size: 12))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.