Use for xib and storyboard
What is an IBLinter?
IBLinter is a specific linting tool for .xib and .storyboard files in iOS projects. This tool will help you identify issues related to user interface rules, layout, and properties in your .xib files. IBLinter validates .xib files against defined rules and provides reports on errors and warnings found.
To use IBLinter, you need to install it first. Here are the general steps to install IBLinter using CocoaPods
https://github.com/IBDecodable/IBLinter
But in this article, we do not use pod, just install terminal
$ brew install iblinter
How to Use IBLinter
All xib and storyboard
$ iblinter lint
The path to the project root directory (--path (string))
$ iblinter lint --path /Users/user/app/Features/running
The reporter use to log errors and warnings (--reporter (string))
$ iblinter lint --reporter json
When running in a terminal
➜ TestProjectT $ iblinter lint
/Users/user/Documents/App_Template/TestApp/TestProjectT/TestProjectT/Base.lproj/Main.storyboard:0:0: error: UILabel (ZhV-dX-CRA) has ambiguous constraints
/Users/user/Documents/App_Template/TestApp/TestProjectT/TestProjectT/NewGroup/TestViewController.xib:0:0: error: UILabel (dbr-8o-vU3) has ambiguous constraints
➜ TestProjectT $ iblinter lint --path /Users/user/Documents/App_Template/TestApp/TestProjectT/TestProjectT/NewGroup
/Users/user/Documents/_Template/TestApp/TestProjectT/TestProjectT/NewGroup/TestViewController.xib:0:0: error: UILabel (dbr-8o-vU3) has ambiguous constraints
➜ TestProjectT $ iblinter lint --reporter json
[
{
"message" : "UILabel (ZhV-dX-CRA) has ambiguous constraints",
"file" : "\/Users\/user\/Documents\/_Template\/TestApp\/TestProjectT\/TestProjectT\/Base.lproj\/Main.storyboard",
"level" : "error"
},
{
"message" : "UILabel (dbr-8o-vU3) has ambiguous constraints",
"file" : "\/Users\/user\/Documents\/App_Template\/TestApp\/TestProjectT\/TestProjectT\/NewGroup\/TestViewController.xib",
"level" : "error"
}
]
Combine path and json
➜ TestProjectT $ iblinter lint --path /Users/user/Documents/_Template/TestApp/TestProjectT/TestProjectT/NewGroup --reporter json
[
{
"message" : "UILabel (dbr-8o-vU3) has ambiguous constraints",
"file" : "\/Users\/user\/Documents\/App_Template\/TestApp\/TestProjectT\/TestProjectT\/NewGroup\/TestViewController.xib",
"level" : "error"
}
]
This can also configure IBLinter by adding a .iblinter.yml file to the main project directory.
Rules that can be set up in the yml file: https://github.com/IBDecodable/IBLinter/blob/master/Rules.md