Reputation: 433
I have and old Xcode project with too many ViewControllers in one Storyboard. Is there a shortcut way to know the count of all ViewControllers in a Storyboard? Xcode version is 11.2.1.
Upvotes: 2
Views: 510
Reputation: 1786
Well it's not the perfect way but, I've find a work around to get the count on my own as i like to code for Auto Layout. I hope it helps you too.
Right click on storyboard -> open as Source code
search following text in editor = sceneMemberID="viewController"
this will give you search count just like any editor including table and collection view controller as all have the same sceneMemberId, please find attachment to get a clear view.
Upvotes: 0
Reputation: 20234
You could use the terminal to run a grep
command to search some string:
grep -r -c --include \*.storyboard sceneID .
in form:
grep -r -c --include [pattern] [search string] [search path]
-r
to search recursively-c
to show count--include [pattern]
to search in files that match the given pattern, such as:
--include \*.storyboard
to search all files with storyboard
extension--include \Main.storyboard
to search in files named Main.storyboard
only[search string]
is the string to search for. Example:
sceneID
seems to be a good enough search parameter to locate all the viewController
s, even those that don't have a class associated[search path]
to specify where to search from. Example:
.
to search from current folder; you should be in the project's base folder for better search resultsThe output should look like:
.../Main.storyboard:12
where 12
is the number of scenes in Main.storyboard
Upvotes: 4