| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
1,308 バイト追加 、 2021年4月11日 (日) 13:50
var ip: String = ""
var macaddr: String = ""
}
</pre>
 
===親Viewのサイズ情報を取得しレコードごとにグリッドの列のサイズを揃える===
----
*https://qiita.com/masa7351/items/0567969f93cc88d714ac
*https://www.hackingwithswift.com/quick-start/swiftui/how-to-make-two-views-the-same-width-or-height
[[File:swiftui_grid_layout1.png|200px]]
[[File:swiftui_grid_layout2.png|400px]]
<pre>
struct HostView : View {
var host: WoL.Host
var body: some View {
GeometryReader { geo in
HStack() {
Text(host.host)
.padding()
.frame(width: geo.size.width * 0.33 , alignment: .leading)
.frame(maxHeight: .infinity)
.background(Color.red)
Text(host.ip)
.padding()
.frame(width: geo.size.width * 0.33 , alignment: .leading)
.frame(maxHeight: .infinity)
.background(Color.green)
Text(host.macaddr)
.padding()
.frame(width: geo.size.width * 0.33 , alignment: .leading)
.frame(maxHeight: .infinity)
.background(Color.yellow)
}.fixedSize(horizontal: false, vertical: true)
}.frame(height: 60)
}
}
</pre>

案内メニュー