0Pricing
SwiftUI Academy · Aula

Fontes, espessura e cor

Estilize o texto com font, fontWeight e foregroundStyle.

Fontes, espessura e cor é uma aula grátis de SwiftUI Academy no CoddyKit. Esta é a aula 1 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de SwiftUI Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de SwiftUI Academy inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

Styling Starts Here

A plain Text view shows words, but real apps style them. In this lesson you will set font, weight, and color to make text feel intentional. 🎨

The font Modifier

The font modifier picks a text style. Apple ships semantic sizes like title, headline, and body that adapt to the user automatically.

Text("Welcome")
    .font(.title)

Semantic Font Styles

Prefer semantic styles over fixed point sizes. Names like .largeTitle and .caption scale with the device and the user accessibility settings.

Text("Big").font(.largeTitle)
Text("Small").font(.caption)

Custom Point Sizes

Need an exact size? Pass .system(size:) with a number. It is handy for logos, but semantic styles are better for body text.

Text("Logo")
    .font(.system(size: 40))

Adding Weight

The fontWeight modifier sets how thick the strokes look. Try .bold for emphasis or .light for a softer, airier feel.

Text("Strong")
    .fontWeight(.bold)

Weight Inside font

You can also bake the weight right into the font call. This keeps related styling in one tidy place.

Text("Heavy")
    .font(.title.weight(.heavy))

Coloring Text

Use foregroundStyle to color text. Pass a Color like .red or a brand color, and the words pick up that tint instantly.

Text("Alert")
    .foregroundStyle(.red)

Semantic Colors

Reach for semantic colors like .primary and .secondary. They adapt to light and dark mode so your text stays readable everywhere.

Text("Hint")
    .foregroundStyle(.secondary)

Italic and Bold Shortcuts

SwiftUI offers quick toggles: .bold() and .italic(). They read cleanly and skip the longer modifier names.

Text("Note")
    .bold()
    .italic()

Chaining Modifiers

Modifiers stack top to bottom. Combine font, weight, and color on one Text to shape its full look in a single chain.

Text("Title")
    .font(.title)
    .bold()
    .foregroundStyle(.blue)

Order Can Matter

Most text modifiers commute, but order matters once layout enters. Keep styling first, then add padding or background later.

Quick Check

Which modifier sets the text color?

Lesson Recap

You styled text with font, fontWeight, and foregroundStyle. Lean on semantic styles and colors so your UI adapts beautifully. ✨

Perguntas Frequentes

A aula “Fontes, espessura e cor” é grátis?

Sim — o texto completo de “Fontes, espessura e cor” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de SwiftUI Academy, atualize para CoddyKit PRO. O curso de SwiftUI Academy inclui 4 aulas no total.

O que vou aprender em “Fontes, espessura e cor”?

Estilize o texto com font, fontWeight e foregroundStyle. Você pratica SwiftUI Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar SwiftUI Academy?

Nenhuma experiência prévia é necessária. SwiftUI Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 1 de 4.

Quanto tempo leva a aula “Fontes, espessura e cor”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de SwiftUI Academy?

Sim. Cada aula de SwiftUI Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Fontes, espessura e cor
  2. Texto multilinha e alinhamento
  3. Carregando imagens dos recursos
  4. Usando SF Symbols
← Voltar para SwiftUI Academy