I'm trying to write a small ruby gem to generate statistics about my Xcode project. I have no problem with file numbers, row numbers and so on, but I want also generate statistics about the number of methods, number of classes etc.
There is some kind of obj-c parser written in Ruby? The alternative can be to interact with OCLint executable but I'm scared it will be a lot of work for a small utility.
I am not aware of such a publicly-available parser—or grammar for that matter—that represents Obj-C syntax in Ruby.
Here are a couple ways that come to mind to solve your task.
If you're interested in counting certain metadata about files, you can try making a naive, poor-man's "parser" using regular expressions that extract this metadata.
If you're merely interested in the number of methods and such (symbols) of a compiled project, you can use otool
or nm
to dump symbols (nm
will dump global variables as well) of your object (compiled binary).
Not 100% if these tools work on compiled Swift objects
otool -TV <object>
nm -a <object>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With