Observable objects, environment objects, and @Published - SwiftUI Starter Project 6/14

preview_player
Показать описание
In this video we look at how the ObservableObject protocol and @Published property wrapper allow us to use dynamic content in SwiftUI views.

This project is aimed at programmers who have some experience with Swift and UIKit already, and want to get up to speed with SwiftUI as quickly as possible.
Рекомендации по теме
Комментарии
Автор

I really love how you give under the hood understanding of all the stuff that you use. Very few people do this. Love it! Hopefully one day you want to explain the difference between SwiftUI, UIKit and Foundation with all this background knowledge, or maybe you already did, in that case, I'll find it one of these days.

saskiaa
Автор

To simplify: that quite brilliant solution called EnvironmentObject is a Singelton, which every developer has tried to avoid for the past 30 years :P

kimimsc
Автор

been working through these, thank you so much!

Rheynez
Автор

How do you deal with the situation that the @StateObject needs additional objects that must be passed in as a dependency and are defined in the same view? I am scratching my head about this.

tombruckner
Автор

Can someone explain this @StateObject more in detail, because i dont understand it.
we have class Order that conforms to ObservableObject, that has @Published items, that we will check if it changes.
Order/Item view have @EnvironmentObject order where they check if it changes.
i dont get it, what role of StateObject has here.

japonska
Автор

I'm trying to do the exact opposite.... pass a TextField var from a View to a class.

TImHagele