Xcode 14 工作正常,但在 Xcode 15 中停止工作。
我尝试使用 Xcode 15 预览版、.sizeThatFits 和 .fixed
#Preview {
AddRegionView()
.previewLayout(.fixed(width: 100, height: 100))
// .previewLayout(.sizeThatFits)
}
使用
#Preview
宏时,之前作为修饰符附加的设置现在作为特征添加到宏声明中,例如:
#Preview(traits: .sizeThatFitsLayout) {
ContentView()
}
或固定尺寸:
#Preview(traits: .fixedLayout(width: 100, height: 100)) {
ContentView()
}