Yes, click โfix it,โ xcode will add the necessary methods and variables as indicated in your protocol, and one more thing, Xcode will add the variables with the appropriate read permissions to the class that implements the protocol.
For example: in your protocol, if you declare a get, set variable, and in your structure / class you declare it as a 'let' property, then Xcode will display the error message โWant to add a protocol stubโ when you click fix it, now add the 'var' property in the protocol, while maintaining the class / structure to receive, set the property in the protocol
protocol VoiceAssistant { var name: String {get} var voice: String {get set} } struct Siri: VoiceAssistant { var voice: String
source share