I want to customise one UITextField for some reason. So currently I subclassed it and added few methods.
Instead of that can I use extension over UITextField ? Which is
As a general rule of thumb (YMMV):
UITextField
? If so, make an extension. All UITextField
instances can call the new methods.UITextField
that you would identify precisely? If so, make a subclass. Only the instances of the subclass can use the new methods.There are other technical considerations, like extensions can't add fields, for instance.
Swift extensions can't be overridden. So If you would like to create a testing purpose subclasses then you will be limited.