Swift EdgeInsetsクラスを使って余白を追加するサンプル
環境
Swift version 5.2.3 (swift-5.2.3-RELEASE)
Ubuntu 20.04.2 LTS
構文
top: topPadding
padding修飾子の引数に EdgeInsetsクラスを指定します。
EdgeInsetsクラスの引数「top」に上の余白を指定します。
他の引数には、「0」を指定します。
使用例
TestView()
.padding(EdgeInsets(
top: topPadding,
leading: 0,
bottom: 0,
trailing: 0
))
TestView()
.padding(EdgeInsets(
top: topPadding,
leading: 0,
bottom: 0,
trailing: 0
))
TestView() .padding(EdgeInsets( top: topPadding, leading: 0, bottom: 0, trailing: 0 ))