Skip to content

Instantly share code, notes, and snippets.

@timstudt
Created January 8, 2021 10:30
Show Gist options
  • Save timstudt/16b66d0f76c1018cebf2d5c5b3c67bc0 to your computer and use it in GitHub Desktop.
Save timstudt/16b66d0f76c1018cebf2d5c5b3c67bc0 to your computer and use it in GitHub Desktop.
SwiftUI playground crash
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View {
List {
ForEach((1...10).reversed(), id: \.self) {
Text("\($0)")
}
}
}
}
let content = ContentView()
_ = content.body // no crash
//PlaygroundPage.current.setLiveView(content) // signal SIGABRT.
//PlaygroundPage.current.setLiveView(ContentView()) // signal SIGABRT.
// from https://developer.apple.com/documentation/playgroundsupport/playgroundpage
//PlaygroundPage.current.setLiveView( // signal SIGABRT.
// List(0..<42) { number in
// Text("My favorite number is \(number).")
// }
//)
PlaygroundPage.current.setLiveView( // works
Text("Hello")
)
@timstudt
Copy link
Author

timstudt commented Jan 8, 2021

error: Playground execution aborted: error: Execution was interrupted, reason: signal SIGABRT.
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment