In Xcode I would like to add a delegate such as UITextFieldDelegate
and have methods such as textFieldShouldReturn
auto added to my document
In Java when I include an interface, my IDE typically forces me to auto-add some particular classes, which I tend to add code into.
Is there any way to do this in Xcode?
All of the methods in the
UITextFieldDelegate
protocol are optional, so Xcode won't give you any warnings. If you try something likeUITableViewDataSource
, you'll see Xcode gives you warnings for the required methods that your class hasn't implemented.I don't know of a way to auto-fill those methods, but it's really easy to cmd+click
UITextFieldDelegate
and copy/paste the methods you need. It's possible that there is an Xcode plugin out there that would auto-fill the required methods for you.