Is it possible to check whether an identifier exists in a storyboard before instantiating the object?

后端 未结 6 1391
-上瘾入骨i
-上瘾入骨i 2021-02-19 06:53

In my code I have this line, but I was wondering if there is way to check whether @\"SomeController\" exists before I use it with the \"instantiateViewControllerWit

6条回答
  •  滥情空心
    2021-02-19 07:27

    You can wrap the code with try-catch exception handling and decide how to react if such an exception occurs. I use this method to dynamically instantiate view controllers without having to know if they are represented in the Storyboard or a nib file.

提交回复
热议问题