DEV Community

Discussion on: Creating a login screen in SwiftUI

Collapse
 
mklagassey profile image
mklagassey

Writing this for others who may run into the same situation. I was getting a consistent error: "Type 'ErrorTextField' does not conform to protocol 'View'" on the ErrorTextField struct so I tried reloading xcode and even downloaded the completed project files from github to compare the swift file. They were the same but my code caused the error which prevented a successful build. Very frustrating.

The fix turned out to be simply copy/pasting the entire code from the completed project file over my own. When I reverted back to the previous code which had caused the error (which still wasn't complete as I didn't get any further than adding the preview code) it stopped throwing the error even though nothing had changed.

Lesson learned, don't trust the error messages in SwiftUI yet. Many are not that helpful and some of them are misleading or completely wrong!