struct SidebarView_Previews: PreviewProvider {
static var previews: some View {
HStack {
//... All your views ...
}.previewLayout(.fixed(width: 375 * 2, height: 812))
}
}
只需将预览的Group替换为HStack,如下:
struct SidebarView_Previews: PreviewProvider {
static var previews: some View {
Group {
//... All your views ...
}
}
}
至:
struct SidebarView_Previews: PreviewProvider {
static var previews: some View {
HStack(spacing: 20) {
//... All your views ...
}
}
}