# TextField ⟩ formats

{% tabs %}
{% tab title="💾 程式" %}
```swift
// .number
@State private var score = 0    // Int
TextField("Enter your score", value: $score, format: .number)
```
{% endtab %}

{% tab title="📗 參考" %}
* [x] Paul ⟩ [How to format a TextField for numbers](https://www.hackingwithswift.com/quick-start/swiftui/how-to-format-a-textfield-for-numbers)
* [ ] flaviocopes ⟩ [SwiftUI: formatting decimals in Text view](https://flaviocopes.com/swiftui-formatting-decimals-text-view/)
* [ ] Sundell ⟩ [Formatting numbers in Swift](https://www.swiftbysundell.com/articles/formatting-numbers-in-swift/)
* [ ] Sarunw ⟩ [TextField in SwiftUI](https://sarunw.com/posts/textfield-in-swiftui/#oneditingchanged-and-oncommit)
{% endtab %}

{% tab title="👥 相關" %}
* [](<> "mention")
* [textfield-+-style](styles/textfield-+-style "mention")
{% endtab %}
{% endtabs %}
