re: From Storyboards to Code in iOS VIEW POST


If I understand correctly, if you want to revisit a view later, you have to copy it into playground again? Still sounds tedious.

Does this address one problem we've found with automated ui testing where views don't have useful ids? (xcode usually generates random ids for views which you can't control). Here I guess you could set your own.

In android, views are usually defined in xml in subcomponents as small as you like. You give each view you want to reference in code an id that you define. When writing a ui test, logically named ids are easy to reference.


I think the problem with providing proper id's to view can be solved by writing an extension over UIView and adding @IBInspectable property to UIView using associated type. Though it would work like a tag with string type instead of int. You can do that if it helps! :)


Yes, you would have to copy-paste back and forth in most cases. I'm sure there's a workaround somewhere, although it's a small price to pay for the benefit that programatic views provide and not every solution is perfect. Both methods of creating views have their issues.

Addressing the automated UI-testing, I'm not sure on that. I'd assume you'd be able to set the IDs somehow.

code of conduct - report abuse