RowはただのHStackです。
//
// ListRowView.swift
// SwiftUIList
//
// Created by tsu-na-gu on 2026/04/12.
//
import SwiftUI
struct BasicImageRow: View {
let restraunt: Restaurant
var body: some View {
HStack {
Image(restraunt.image)
.resizable()
.frame(width: 40, height: 40)
.cornerRadius(6)
Text(restraunt.name)
}
}
}
#Preview {
let restraunt = Restaurant(name: "Cafe Deadend", image: "cafedeadend")
BasicImageRow(restraunt: restraunt)
}
これをそのままListに入れると画像の端までセパレーターが伸びない

その回避方法は行毎に
swift.
alignmentGuide(.listRowSeparatorLeading) { _ in 0 }
をいれる事。
ContentView全体は
//
// ContentView.swift
// SwiftUIList
//
// Created by tsu-na-gu on 2026/04/12.
//
import SwiftUI
struct ContentView: View {
var body: some View {
List {
ForEach(restaurants.indices, id: \.self) { index in
if (0...1).contains(index) {
FullImageRow(restraunt: restaurants[index])
} else {
BasicImageRow(restraunt: restaurants[index])
}
}
.alignmentGuide(.listRowSeparatorLeading) { _ in
0
}
}
.listStyle(.plain)
}
}
#Preview {
ContentView()
}
これで端まで引かれます。
