Is it possible to reuse iOS xibs for tvOS? If I try to do that, I get the following error:
iOS xibs do not support target device type TV
Is it possible to reuse iOS xibs for tvOS? If I try to do that, I get the following error:
iOS xibs do not support target device type TV
You should expect to need to make new XIBs & SBs for your tvOS app/target.
Any specific reasoning behind this? For example, if I have a simple UICollectionViewCell subclass, it would be nice to be able to reuse this sort of thing?
Assuming there are no unsupported UI elements or properties, you can just make a copy of the nib file and edit some of the metadata in the XML.
You need to replace these elements at the top of the file with those lines from a tvOS nib file:
<document ...>
<dependencies>
<plugIn ...>
</dependencies>
Make sure your tvOS target includes only the correct nib.
I'd be interested to hear about files this fails for. I've been using it for custom views, which are simple enough to be reusable on a TV. I don't imagine you'd want to do this for view controllers.
Of course, this isn't proper reuse. You now have two files that need to be maintained. But you'll be used to that if you use nibs 😉
The reasoning would seem to be the blatant mismatch in layouts vs. screen size, I'd think.
Apples vs. oranges and all that.
Not if you use AutoLayout, no?
Right, it would seem they are encouraging more code reuse between all platforms with the introduction of size classes? Even so, there are many small views that would be awesome if we could reuse between platforms such a table cells.
I'm a fan of size classes. Auto layout...not so much.