News for hackers. Stuff that matters.
Re:Building DSLs in Swift by programmarchy on Monday October 15, 2018 @01:44AM (#18217655)
So your storyboard just defines segues and types, then your view controllers call initWithNib?

That sounds very reasonable. I find IB to be excellent for creating layouts quickly, especially combined with @IBDesignable and @IBInspectable.

My problem with relying on storyboards has been when I need to reuse a layout in a separate workflows. What’s nice about your technique is that it allows separate storyboards but also layout reuse with nibs.

Re:Building DSLs in Swift by jawngee on Monday October 15, 2018 @03:55AM (#18218107)
Actually, iOS will automagically load your xib for your view controllers at runtime.

- In the storyboard, delete the root view for the view controller.

- Create a new xib named the same as the view controller's class and that will get loaded without having to do anything additional.

Here's a quick example of what I'm talking about: https://github.com/jawngee/StoryboardWithXibs