IBDecodable / IBLinter

A linter tool for Interface Builder
MIT License
948 stars 42 forks source link

Cannot detect incorrect target module at .xib in main bundle #127

Closed sidepelican closed 4 years ago

sidepelican commented 5 years ago

Minimum example. IBLintTest.zip

スクリーンショット 2019-11-15 20 10 15

MyView in MyView.xib references IBLintTest as custom module but the correct module target is ModuleA so this app crashes on runtime. I hope IBLinter detect this situation.

version: IBLinter@0.4.20

phimage commented 5 years ago

Make a github project instead of zip, it easier for us. You can provide a link to the line in xib where the issue is. etc.

Did you try to configure custom_module_rule? (I have never do it myself)


Why MyView.xib is not in ModuleA with its code? using Bundle(for: MyViewUsingViewController.self) instead of .main

This is not an issue in xib only. To detect issue like that, your pbxproj must be parsed to create a map of all files by targets. Then for each class with module check it existant in targets' files If the framework is compiled (with carthage for instance) it will be more complicated


PS: Then It crash because you make it crash using 'as! MyView'. As a swiftlint addict, never use it... see force_cast But that's not the issue. This show your issue.

sidepelican commented 4 years ago

Sorry, I'm not much interested in this now.