GitHawkApp / GitHawk

The (second) best iOS app for GitHub.
http://githawk.com
MIT License
2.88k stars 382 forks source link

Asset generation similar to Android R #955

Open rnystrom opened 6 years ago

rnystrom commented 6 years ago

I've seen some things that allow you to have more compile safety for initializing image assets, XIBs, and storyboards. I'd love to get more safety around loading assets. Anyone have any favorites?

Iron-Ham commented 6 years ago

Like loading views from nibs & vc from storyboard?

re: assets, I just use #imageLiteral

https://github.com/heshamsalman/ReusableViews#convenient-instantiation-of-a-view-from-a-nib

rnystrom commented 6 years ago

Hell ya, that’s exactly what I want to do.

Sent with GitHawk

Iron-Ham commented 6 years ago

using it in prod and it's been great for our needs

there are limitations:

using convenience dequeue methods that make cell instantiation safer requires registry of that cell even if it's a UITableViewCell. Using a special style of a cell like UITableViewCellValue1 requires a class that basically instantiates that way. Final caveat is that it only supports nibs that are used to house one view, and there isn't support for views that can instantiate from multiple nibs.

so basically if you have a nib structured like this:

MyNib:
   | > ClassA
      | > ClassB Contents
      | ...
   | > ClassB
      | > ClassB Contents

there's no support for picking out ClassB through the convenience methods

rnystrom commented 6 years ago

That's weird, 2 classes in one xib? Who does that? 🙅

rnystrom commented 6 years ago

SwiftGen looks awesome

https://github.com/SwiftGen/SwiftGen