Skip to content

Instantly share code, notes, and snippets.

@mchakravarty
Created September 9, 2020 13:50
Show Gist options
  • Select an option

  • Save mchakravarty/afd2e1ff3629d2afbd1ffbc10fb00bc6 to your computer and use it in GitHub Desktop.

Select an option

Save mchakravarty/afd2e1ff3629d2afbd1ffbc10fb00bc6 to your computer and use it in GitHub Desktop.
SwiftUI AttributeGraph cycle in playground only
// Put this into an Xcode 12.0 multiplatform app
import SwiftUI
struct ContentView: View {
@State var text = "Hello!"
var body: some View {
VStack {
TextEditor(text: $text)
HStack {
Spacer()
Text("\(text.count) characters")
}
}
}
}
@main
struct CountingEditorAppApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
// Put this into an Xcode 12.0 iOS playground
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
@State var text = "Hello!"
var body: some View {
VStack {
TextEditor(text: $text)
HStack {
Spacer()
Text("\(text.count) characters")
}
}
}
}
import PlaygroundSupport
PlaygroundPage.current.setLiveView(ContentView())
@bsrz

bsrz commented Mar 17, 2021

Copy link
Copy Markdown

@mchakravarty experiencing the same in Xcode 12.4, did you ever find out what was the issue?

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