问题
When I open the storyboard file, it takes between 1-2 minutes to open because of the number of VCs I have in it. What is the best practice to speed it up? Should we move some VCs into different storyboard files? Should we use more xib files to reduce the number of elements in VCs? Any suggestions would be great on what poor practices we might have implemented to make the storyboard loading time so slow.
回答1:
Good practice:
- Keep your
ViewControllers
in differentstoryboard
which are not logically related to each other. It will
considerably reduce story board rendering/opening time. It will also very helpful to avoid conflicts in storyboard when working with
teams. - Try to UI elements to
xib
file, liketableViewCell
,collectionViewCell
,buttons
, etc - Try to customise UI objects using code rather than
IBInspectable
/IBDesignable
.
Bad practice:
- Keeping all viewControllers in single storyboard file. Because it will take much time to render all UI objects in storyboard file, and its position in storyboard.
Thanks
回答2:
Please open two tab by using command + T in your Xcode
, one for ViewController
and other for storyboard
. It will speed up your storyboard
because by opening two tabs, ViewController
and storyboard
files are already loaded. For more help, Please see the attached image below.
来源:https://stackoverflow.com/questions/44125590/speed-up-storyboard-opening