Skip to content

This provides flexible stack layout in SwiftUI.

License

Notifications You must be signed in to change notification settings

Kyome22/FlexibleStack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FlexibleStack

This provides flexible stack layout in SwiftUI.

Optimizes the arrangement of items according to the aspect ratio of the parent view.

Optimize the arrangement of items according to the number of them.

Requirements

  • Development with Xcode 16.2+
  • Written in Swift 6.0
  • Compatible with iOS 16.4+

Usage

struct ContentView: View {
    let colors: [Color] = [.blue, .red, .green, .orange]

    var body: some View {
        FlexibleVStack {
            ForEach(colors.indices, id: \.self) { index in
                Rectangle()
                    .foregroundStyle(colors[index])
                    .frame(maxWidth: .infinity, maxHeight: .infinity)
            }
        }
        .padding()
    }
}

About

This provides flexible stack layout in SwiftUI.

Resources

License

Stars

Watchers

Forks

Languages