Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't UIView (or it's subclasses) adopt the NSCopying Protocol?

Can a Cocoahead please explain why UIView and it's sub classes don't adopt the NSCopying Protocol?

I can see, philosophically, why UITouch would not be copy compliant, as it's a very temporal object. By UIView, and it's subclasses, especially UIButton, seem like they should be able to be copied.

Certainly Apple has good reasons for doing things the way they do. Do you know their reason?

like image 725
SooDesuNe Avatar asked Dec 23 '22 08:12

SooDesuNe


1 Answers

It would seem the question they asked wasn't "Why not?" but "Why do it?" There's little point to doing so. There's rarely a need to copy a live view. Usually, template views are created through the NSCoding protocol (i.e. with Interface Builder), and that's about all a copyable view would be good for.

like image 192
Chuck Avatar answered Jan 19 '23 00:01

Chuck