tyagishi / SDSLayout

SwiftUI Layout conforming to Layout

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SDSLayout

custom layouts which conform to SwiftUI.Layout

FlexHFlow

horizontal flow layout

DiagnoalStack

layout views along diagonal direction

DiagonalStack

struct ContentView: View {
    @State private var colors: [Color] = [.red, .blue, .purple, .orange, .yellow]
    
    var body: some View {
        VStack {
            Text("DiagonalStack() note: border(.red)")
            DiagonalStack() {
                ForEach(colors.indices, id: \.self) { index in
                    colors[index].frame(width: 25, height: 25)
                }
            }
            .border(.red)

            Text("DiagonalStack(hSpacing: -20, vSpacing: -20) note: border(.yellow)")
            DiagonalStack(hSpacing: -20, vSpacing: -20) {
                ForEach(colors.indices, id: \.self) { index in
                    colors[index].frame(width: 25, height: 25)
                }
            }
            .border(.yellow)

        }
        .padding()
    }
}

About

SwiftUI Layout conforming to Layout


Languages

Language:Swift 100.0%