Although writing down the examples can help you remember what you are learning, sometimes it can be time consuming. To speed up the process, you can download the codes in TXT files, all Xcode projects, or open the codes you want to see from the links below.
Representable views now must be created from the Main Actor to avoid data races in Swift 6 (This doesn't apply if you are using Swift 5)
The following are the changes we have introduced to the examples in this chapter:
Listing 18-11
The cameraView property must be initialized from the Main Actor. Because the property is now initialized inside a Task, we need to make it observable by removing @ObservationIgnored, so the views know when there is a new value available. We also need to call init() in the superclass to initialize the properties of the NSObject class first.
Listing 18-24
The customVideoView property must be initialized from the Main Actor. Because the property is now initialized inside a Task, we need to make it observable by removing @ObservationIgnored, so the views know when there is a new value available.
Listing 18-26
The customVideoView property must be initialized from the Main Actor. Because the property is now initialized inside a Task, we need to make it observable by removing @ObservationIgnored, so the views know when there is a new value available.
Listing 18-28
The customVideoView property must be initialized from the Main Actor. Because the property is now initialized inside a Task, we need to make it observable by removing @ObservationIgnored, so the views know when there is a new value available.
Listing 18-29
The customVideoView property must be initialized from the Main Actor. Because the property is now initialized inside a Task, we need to make it observable by removing @ObservationIgnored, so the views know when there is a new value available.