An optional string key to display as a badge. Set the value to nil
to hide the badge.
Instance Method
インスタンスメソッド
badge(_:)
Generates a badge for the view from a localized string key.
Availability 有効性
- iOS 15.0+
- iPadOS 15.0+
- macOS 12.0+
- Mac Catalyst 15.0+
Technology
- Swift
UI
Declaration 宣言
func badge(_ key: LocalizedStringKey
?) -> some View
Parameters パラメータ
key
Discussion 議論
Badges are only displayed in list rows and tab bars.
Use a badge to convey optional, supplementary information about a view. Keep the contents of the badge as short as possible.
This modifier creates a Text
view on your behalf, and treats the localized key similar to init(_:
. See Text
for more information about localizing strings.
Text
を文字列のローカライズについてのさらなる情報として見てください。