We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e638af2 commit 7710a19Copy full SHA for 7710a19
Guide.docc/Articles/ProvideModifierWithParameter.md
@@ -13,12 +13,16 @@ SwiftUIでは、条件に応じてViewの見た目や振る舞いを変更する
13
引数のないmodifierを条件分岐によって切り替えるには、`if`文を使用する必要があります:
14
15
```swift
16
-
17
struct ContentView: View {
18
@State var condition = false
19
20
var body: some View {
21
- xxx
+ if condition {
+ Text("nice")
22
+ .nicelyStyled()
23
+ } else {
24
25
+ }
26
}
27
28
```
@@ -30,5 +34,12 @@ struct ContentView: View {
30
34
引数を持つmodifierを提供すると、条件分岐を引数に移動することで同一のView identityで表現できます:
31
35
32
36
33
-xxx
37
+struct ContentView: View {
38
+ @State var condition = false
39
+
40
+ var body: some View {
41
42
+ .textStyle(condition ? .nicely : .primary)
43
44
+}
45
0 commit comments