Swift DatePickerの日付に選択範囲を設定するサンプル

環境
Swift version 5.2.3 (swift-5.2.3-RELEASE)

概要
From … To
FromからToまでの範囲
From …
Fromからの範囲
… To
Toまでの範囲
DatePickerに選択範囲を追加するには、DatePickerの「in」引数を使います。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
//From ... To範囲
DatePicker(
selection : $date,
in : dateA ... dateB,
label : { Text("") }
)
//From...範囲
DatePicker(
selection : $date,
in : dateA ... ,
label : { Text("") }
)
//...To範囲
DatePicker(
selection : $date,
in : ... dateB,
label : { Text("") }
)
//From ... To範囲 DatePicker( selection : $date, in : dateA ... dateB, label : { Text("") } ) //From...範囲 DatePicker( selection : $date, in : dateA ... , label : { Text("") } ) //...To範囲 DatePicker( selection : $date, in : ... dateB, label : { Text("") } )
//From ... To範囲
DatePicker(
     selection : $date,
     in : dateA ... dateB,
     label : { Text("") }
     )

//From...範囲
DatePicker(
     selection : $date,
     in : dateA ... ,
     label : { Text("") }
     )

//...To範囲
DatePicker(
     selection : $date,
     in :  ... dateB,
     label : { Text("") }
     )

 

IT

Posted by arkgame