Find common xib and storyboard-related problems without running your app or writing unit tests.
Usage
Pass a path to your project to ibanalyzer command line tool. Here's an example output you can expect:
$ ./ibanalyzer ~/code/Sample/
TwitterViewController doesn't implement a required @IBAction named: loginButtonPressed:
TwitterViewController doesn't implement a required @IBOutlet named: twitterImageView
LoginViewController contains unused @IBAction named: onePasswordButtonTapped:
MessageCell contains unused @IBOutlet named: unreadIndicatorView
MessagesViewController contains unused @IBAction named: infoButtonPressed
With IBAnalyzer, you're able to:
-
Find unimplemented outlets & actions in classes. Avoid crashes caused by exceptions, like the dreadful:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: ' [<Sample.TwitterViewController 0x7fa84630a370> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key twitterImageView.' -
Find
@IBOutlets and@IBActions defined in code but not connected to from nibs. No more:and
Drawbacks
This is a new tool, used only on a handful of projects till now. If you encounter any bugs, please create new issues.
Doesn't work with Objective-C. Tested on Swift 3.0.
How It Works
IBAnalyzer starts by parsing all .xib, .storyboard and .swift files in the provided folder. It then uses this data (wrapped in AnalyzerConfiguration) to generate warnings.
You can see the source of an analyzer checking connections between source code and nibs here.
New warnings can be implemented by adding a new type conforming to the Analyzer protocol and initializing it in main.swift. Check issues to
learn about some ideas for new warnings.
Installation
Manual
- Clone or download the repo.
$ pod install- Open
IBAnalyzer.xcworkspacein Xcode 8.2 and build the project (⌘-B). $ cd Build/MacOS$ ./ibanalyzer /path/to/your/project
Binary
Not implemented yet. Help welcomed!
Attributions
- SourceKitten – IBAnalyzer wouldn't be possible without it
- SwiftGen – inspiration for
NibParser
Author
Project initially started by Arek Holko (@arekholko on Twitter).


