Created
September 9, 2020 13:50
-
-
Save mchakravarty/afd2e1ff3629d2afbd1ffbc10fb00bc6 to your computer and use it in GitHub Desktop.
SwiftUI AttributeGraph cycle in playground only
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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() | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mchakravarty experiencing the same in Xcode 12.4, did you ever find out what was the issue?