Conditionally import SwiftUI in README.md example (#138)
This demonstrates portability of Tokamak a bit more in my opinion. Also, we had a redundant closing brace in the example code 🤦♂️
This commit is contained in:
parent
1d71fe0c7d
commit
5adc7b2cff
|
@ -34,7 +34,11 @@ Tokamak API attempts to resemble SwiftUI API as much as possible. The main diffe
|
|||
that you add `import TokamakDOM` instead of `import SwiftUI` in your files:
|
||||
|
||||
```swift
|
||||
#if os(WASI)
|
||||
import TokamakDOM
|
||||
#else
|
||||
import SwiftUI
|
||||
#endif
|
||||
|
||||
struct Counter: View {
|
||||
@State var count: Int
|
||||
|
@ -48,7 +52,7 @@ struct Counter: View {
|
|||
Text("\(count)")
|
||||
}
|
||||
) : AnyView(
|
||||
VStack { Text("Limit exceeded") } }
|
||||
VStack { Text("Limit exceeded") }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue