Skip to content

Commit 6d0b94d

Browse files
committed
Better words.
1 parent 50dac9f commit 6d0b94d

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

FewDemo/TemperatureConverter.swift

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ private func renderLabeledInput(label: String, value: String, autofocus: Bool, f
3333
Input(
3434
text: value,
3535
placeholder: label,
36-
enabled: true,
3736
action: fn)
3837
.autofocus(autofocus)
3938
.width(100),

README.md

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Few.swift
22

3-
[React](http://facebook.github.io/react/)-inspired library in Swift for writing
4-
UIs which are functions of their state.<sup><a href="#lol">1</a></sup>
3+
[React](http://facebook.github.io/react/)-inspired library for writing
4+
AppKit/UIKit UIs which are functions of their state.<sup><a href="#lol">1</a></sup>
55

66
[SwiftBox](https://github.com/joshaber/SwiftBox) is used for layout.
77

@@ -10,11 +10,11 @@ UIs which are functions of their state.<sup><a href="#lol">1</a></sup>
1010
[UIs are big, messy, mutable, stateful bags of sadness.](http://joshaber.github.io/2015/01/30/why-react-native-matters/)
1111

1212
Few.swift lets us express UIs as stateless, composable, immutable-ish values of
13-
their state. When their state changes, Few.swift calls a designated render
14-
function and intelligently applies any changes.
13+
their state. When their state changes, Few.swift calls a function to render the
14+
UI for that state, and then intelligently applies any changes.
1515

16-
The state is the necessary complexity of the view. The view is a mapping from
17-
state to its representation.
16+
To put it another way, the state is the necessary complexity of the app. The
17+
view is a mapping from state to its representation.
1818

1919
## Example
2020

@@ -46,7 +46,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
4646
private let appComponent = Component(initialState: 0, render: renderApp)
4747

4848
func applicationDidFinishLaunching(notification: NSNotification) {
49-
let contentView = window.contentView as! NSView
49+
let contentView = window.contentView as NSView
5050
appComponent.addToView(contentView)
5151
}
5252
}
@@ -80,7 +80,6 @@ private func renderLabeledInput(label: String, value: String, autofocus: Bool, f
8080
Input(
8181
text: value,
8282
placeholder: label,
83-
enabled: true,
8483
action: fn)
8584
// Autofocus means that the Input will become the first responder when
8685
// it is first added to the window.
@@ -117,6 +116,9 @@ private func render(component: Few.Component<ConverterState>, state: ConverterSt
117116
}
118117
```
119118

119+
This is super cool because the only thing that's mutating is the state. Few.swift
120+
is in charge of making an in-place changes to the UI when the state changes.
121+
120122
See [FewDemo](FewDemo) for some more involved examples.
121123

122124
## How does this compare to React-Native/Components?

0 commit comments

Comments
 (0)