How to compile a storyboard in a playground

I am creating an application on the playground, I added the Main.storyboard file in this project. but when it compiles, it gives me the following error.

NSInvalidArgumentException', reason: 'Could not find a storyboard named 'Main' in bundle NSBundle 

therefore, I am starting to think that this may be some kind of typo, therefore, the reason for this error. but this was not a problem, so I started searching on google and stackoverflow, but did not find a solution to my problem. However, there are many questions about stackoverflow with the following content, each of which has a very specific scenario.

then I find a github playground project in which the developer adds the main storyboard and compiles it perfectly, but its extension is Main.storyboardc. then I look for the storyboardc extension. so I understand his compilation of storyboards. to check, just double-click Main.storyboard and change its name to Main.storyboadc. then the following error generates

'NSInvalidArgumentException', reason: 'There doesn't seem to be a valid compiled storyboard 

Now at this point I am sure that I must first compile my storyboard and then add it to my playground, because with the extension .storyboardc he did not even find Main storyboards. as I said above. so again I am already checking all the stuff on stackoverflow, each has a very specific scenario. so tell me how to compile main.storyboard.

+4
1

ibtool .

, , ibtool --compile Main.storyboardc Main.storyboard . Main.storyboardc ( Info.plist .nib).

.storyboardc , .

let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
let viewController = storyboard.instantiateViewController(withIdentifier: "MyViewController")

A .storyboardc - , nib.

. man ibtool

+5

Source: https://habr.com/ru/post/1673587/


All Articles