Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yukiny0811 authored Nov 22, 2022
1 parent 1a04f8d commit 82c0f17
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,8 @@ Override ```middleContent()``` function, and define your View.
```.swift
class YourDisplayNode: NodeModelBase {
@objc @Input var input: Int = 0
override func middleContent() -> AnyView {
return AnyView(
Text("number is now -> \(input)")
)
override func middleContent() -> any View {
Text("number is now -> \(input)")
}
}
```
Expand Down Expand Up @@ -168,14 +166,12 @@ class YourInteractiveNode: NodeModelBase {
override func processOnChange() {
output = input * count
}
override func middleContent() -> AnyView {
return AnyView(
Group {
Slider(value: binding(\YourInteractiveNode.count), in: 0...100)
}
.frame(minWidth: 200, maxWidth: 200)
.fixedSize()
)
override func middleContent() -> any View {
Group {
Slider(value: binding(\YourInteractiveNode.count), in: 0...100)
}
.frame(minWidth: 200, maxWidth: 200)
.fixedSize()
}
}
```
Expand Down Expand Up @@ -211,10 +207,8 @@ class YourIONode: NodeModelBase {

class YourDisplayNode: NodeModelBase {
@objc @Input var input: Int = 0
override func middleContent() -> AnyView {
return AnyView(
Text("number is now -> \(input)")
)
override func middleContent() -> any View {
Text("number is now -> \(input)")
}
}

Expand All @@ -225,14 +219,12 @@ class YourInteractiveNode: NodeModelBase {
override func processOnChange() {
output = input * count
}
override func middleContent() -> AnyView {
return AnyView(
Group {
Slider(value: binding(\YourInteractiveNode.count), in: 0...100)
}
.frame(minWidth: 200, maxWidth: 200)
.fixedSize()
)
override func middleContent() -> any View {
Group {
Slider(value: binding(\YourInteractiveNode.count), in: 0...100)
}
.frame(minWidth: 200, maxWidth: 200)
.fixedSize()
}
}
```

0 comments on commit 82c0f17

Please sign in to comment.