Subclassing vs Extension in swift

后端 未结 2 690
慢半拍i
慢半拍i 2021-02-02 16:50

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

2条回答
  •  情歌与酒
    2021-02-02 17:47

    Swift extensions can't be overridden. So If you would like to create a testing purpose subclasses then you will be limited.

提交回复
热议问题