Fuentes, peso y color
Personalice el texto con font, fontWeight y foregroundStyle.
Fuentes, peso y color es una lección gratuita de SwiftUI Academy en CoddyKit. Esta es la lección 1 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de SwiftUI Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de SwiftUI Academy incluye 4 lecciones en total.
Partes de esta lección aún no han sido traducidas y se muestran en 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. ✨
Preguntas frecuentes
¿La lección «Fuentes, peso y color» es gratis?
Sí — el texto completo de «Fuentes, peso y color» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de SwiftUI Academy, actualiza a CoddyKit PRO. El curso de SwiftUI Academy incluye 4 lecciones en total.
¿Qué aprenderé en «Fuentes, peso y color»?
Personalice el texto con font, fontWeight y foregroundStyle. Practicas SwiftUI Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.
¿Necesito experiencia previa para empezar SwiftUI Academy?
No se requiere experiencia previa. SwiftUI Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 1 de 4.
¿Cuánto tiempo toma la lección «Fuentes, peso y color»?
La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.
¿Puedo escribir y ejecutar código en esta lección de SwiftUI Academy?
Sí. Cada lección de SwiftUI Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.
Todas las lecciones de este curso
- Fuentes, peso y color
- Texto multilínea y alineación
- Carga de imágenes desde los recursos
- Uso de SF Symbols