Загрузка...

Mastering Color Views in SwiftUI

In this video, we’re diving into something essential for any iOS developer: Colors in SwiftUI.

In SwiftUI, a Color is a view used to display a rectangular area of a specific color. It is not just a data structure for color values like UIColor in UIKit; instead, it is an actual view component that conforms to the View protocol. This makes it more than just a way to define colors—it is a lightweight and flexible way to fill parts of your SwiftUI interface with color.

Whether you’re designing a simple app or a complex user interface, colors play a huge role in enhancing the look and feel of your design. They can guide users, set the mood, and make your app stand out. But did you know that SwiftUI gives us multiple ways to define and use colors? From built-in static colors like .primary and .secondary, to creating custom colors using RGB, HSB, and even Hex values, the possibilities are endless.

I'm also going to cover how to access UIKit colors that aren’t directly available in SwiftUI—yes, you can still use your favorite UIColor.systemTeal in a SwiftUI project! And to top it off, I’ll show you how to adapt colors dynamically for light and dark modes, making your app look amazing no matter what theme the user has set.
If you want to support my work, you can buy me a coffee :) 
https://ko-fi.com/stewartlynch 

******** Download my StewartLynch YouTube Channel Application - Free *********** 
https://stewartlynch.gumroad.com/l/obsjz

Enroll in my full length multi-target course to build a Mac Menubar app, an iOS App with WIdgets and a WatchKit app
https://stewartlynch-school.teachable.com/p/smile4me-swift-swiftui-app

Table of Contents: 
0:00  Introduction
3:00  SwiftUI Standard Colors
5:05  SwiftUI Semantic Colors
6:01 UIColors (Standard) for Color Views
9:50 UIColors (Element) for Color Views
12:35  Colors from Component Values
15:08 Color Assets
18:02 ColorLiteral
20:42 Color Modifiers

 Starter Project Files: 
https://github.com/StewartLynch/Swift-Colors
Completed Project: 
https://github.com/StewartLynch/Swift-Colors/tree/CompletedSourceCode

References mentioned in video: 
MeshGradients in iOS 18 and Xcode 15
https://youtu.be/s_eQZ8rRV8Y
Color Mixing in iOS 18
https://youtu.be/KoKlr5dqpP4

Recommended Resources: 

RocketSim - Build Apps Faster 
   https://gumroad.com/a/122988499/ftvbh 

BigMountain Studio Books 
SwiftData Mastery in SwiftUI 
   https://www.bigmountainstudio.com/swiftdata/77jt8 
SwiftUI Views Mastery 
   https://www.bigmountainstudio.com/views-16/77jt8 
SwiftUI 5 Book Bundle 
   https://www.bigmountainstudio.com/book-bundle/77jt8 
Combine Mastery in SwiftUI 
   https://www.bigmountainstudio.com/combine/77jt8 
Core Data Mastery in SwiftUI 
   https://www.bigmountainstudio.com/core-data/77jt8 
SwiftUI Animations Mastery 
   https://www.bigmountainstudio.com/animations-16/77jt8 

Other References: 
Stewart Lynch's YouTube Channel: 
   https://youtube.com/@StewartLynch 
Stewart Lynch on Mastodon: 
   https://iosdev.space/@StewartLynch 
Stewart Lynch on BlueSky:
@stewartlynch.bsky.social
Stewart Lynch On Threads: 
   @StewartLynch 
Stewart Lynch on X: 
   https://x.com/StewartLynch 
Stewart Lynch on LinkedIn 
   https://www.linkedin.com/in/stewartlynch

Видео Mastering Color Views in SwiftUI канала Stewart Lynch
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки

На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.

Об использовании CookiesПринять