Last active
March 22, 2020 14:20
-
-
Save DevAndArtist/6c9bf2a3f06e6fc6dd7d6fa52997c17d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BUG: FB7635852 | |
import SwiftUI | |
struct ContentView: View { | |
let count: Int | |
var body: some View { | |
HStack | |
.init(alignment: .top, spacing: 0) { | |
Color | |
.red | |
.border(Color.black) | |
.alignmentGuide(.top) { d in | |
50 | |
} | |
.overlay( | |
GeometryReader { proxy in | |
if proxy.size.height > 100 { | |
Text("BROKEN") | |
.fontWeight(.heavy) | |
.fixedSize() | |
.rotationEffect(.degrees(-90), anchor: .center) | |
.frame(width: proxy.size.width, height: proxy.size.height) | |
} | |
} | |
) | |
ForEach(0..<count, id: \.self) { index in | |
Color | |
.orange | |
.border(Color.black) | |
.overlay(Text("\(index)")) | |
} | |
} | |
.border(Color.blue) | |
.frame(width: 800, height: 100) | |
.border(Color.purple) | |
} | |
} | |
func preview(_ range: Range<Int>) -> some View { | |
ForEach | |
.init(range, id: \.self) { index in | |
ContentView(count: index) | |
} | |
.previewLayout(.fixed(width: 900, height: 400)) | |
} | |
struct ContentView_Previews_1: PreviewProvider { | |
static var previews: some View { | |
preview(0 ..< 8) | |
} | |
} | |
struct ContentView_Previews_2: PreviewProvider { | |
static var previews: some View { | |
preview(8 ..< 16) | |
} | |
} | |
struct ContentView_Previews_3: PreviewProvider { | |
static var previews: some View { | |
preview(16 ..< 24) | |
} | |
} | |
struct ContentView_Previews_4: PreviewProvider { | |
static var previews: some View { | |
preview(24 ..< 32) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment