![見出し画像](https://assets.st-note.com/production/uploads/images/69663283/rectangle_large_type_2_2aa37d1bfe6ad359d3a6d20d1352c39c.png?width=800)
SwiftUIでいこう! -その他いろいろ(new!)-4
submits a TextField
![](https://assets.st-note.com/img/1642406387822-bKulV1BlZJ.png?width=800)
SecureField("Password", text: $password)
.onSubmit{}
との組み合わせでパスワードを使ったログインのような仕組みができます。
この場合は名前とパスワードを入れてリターンすると"Authenticating…"とコンソールに出力するコードとなっています。
ログインする時ボタンを押すタイミングでの処理を書くことができます。
privacySensitive()
customize the submit buttonなど
submitLabel()モディファイアを使うとキーボードの"return"ボタンの名称を変えることができます。
![](https://assets.st-note.com/img/1642512499589-9LNpjkSgTv.png?width=800)
この部分の表示が変わります。種類としては以下があります。
continue
done
go
join
next
return
route
search
send
layout in portrait or landscape
プレビュー画面のカスタマイズができます。通常のプレビューでは以下ですが、
![](https://assets.st-note.com/img/1642513146172-pCtNl68raX.png?width=800)
ContentView()
.previewInterfaceOrientation(.landscapeLeft)
とすると横画面になります。
![](https://assets.st-note.com/img/1642513159312-P3ci2nmXyG.png?width=800)
この記事が気に入ったらサポートをしてみませんか?