Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to load a storyboard in an iOS Playground?

Is it possible to load a storyboard in an iOS Playground? Follow the steps in this questions:

How do you instantiate a Storyboard from a file within an iOS playground?

Compiled Main.storyboard using

ibtool --compile MainMenu.nib MainMenu.storyboard

Added it to the Resources folder of the playground. Then tried loading it:

let storyboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())

This resulting in an error:

Playground execution aborted: Execution was interrupted, reason: signal SIGABRT.

Is this supported in XCode 7.3.1 or even XCode 8?

like image 822
Lescai Ionel Avatar asked Aug 22 '16 11:08

Lescai Ionel


People also ask

Can you use SwiftUI in playgrounds?

In Swift Playgrounds, you can see live Previews of your SwiftUI views just like Previews in Xcode. In a . swiftpm project, you have a default App Preview that generates from the structure that conforms to the App protocol.

Is Swift Playgrounds actually able to make apps and games?

The Swift programming language was designed to be approachable enough to be your very first programming language. Swift is also incredibly powerful, used by professional developers to create over half a million apps on the App Store. Using Swift Playgrounds, you'll be coding within minutes.

What is the difference between playground and Xcode?

Interactive playgrounds help you to quickly prototype and build your applications, and simply provide another great way to interact with your code. An Xcode project, however, creates a new asset folder and pre-made swift and storyboard files. Save this answer.

Can you code in Swift Playgrounds?

Swift Playgrounds teaches concepts and uses real Swift structure, but it's not real code. It doesn't make an app, it just guides Byte around and solves puzzles.


1 Answers

Your storyboard init code works for me if I set up the resource section of the playground with the same structure as an app.

Resources->Base.lproj->Main.storyboardc

like image 75
Phillip Mills Avatar answered Oct 04 '22 05:10

Phillip Mills