Hi, In the Apple Scrumdinger sample, the SpeechRecognizer class conforms to the Observable protocol:
public actor SpeechRecognizer: Observable {
public enum RecognizerError: Error {
case nilRecognizer
.
.
.
The developer help text suggests that the protocol conformance does not add observation functionality.
This class does not use the @Observable macro.
So, how does this work under the hood?
The Observable
protocol is effectively an implementation detail of the @Observable
macro. If you secondary click on @Observable
and choose Expand Macro, you’ll see that part of the expansion is this:
extension MyClass: Observation.Observable {
}
As to what that sample is doing, I suspect that’s just something left over from a historical refactoring. I’d appreciate you filing a bug against the sample.
Please post your bug number, just for the record.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"