Skip to content

mk-conn/wrap-stack

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WrapStack is a set SwiftUI views, WHStack and WVStack designed to add wrapping behavior to regular horizontal and vertical stacks.

Demo

Example

Use similarly to HStack and VStack.

Wrapping horizontal stack (WHStack)

Distribute horizontal content across multiple lines.

WVStack {
  Text("Wrapping…").fixedSize().padding()
  Color.red.frame(height: 200).overlay(Text("1"))
  Color.green.frame(height: 200).overlay(Text("2"))
  Color.blue.frame(height: 200).overlay(Text("3"))
  Color.yellow.frame(height: 200).overlay(Text("4"))
  Text("…content").fixedSize().padding()
}

Wrapping vertical stack (WVStack)

Automatically expand vertical content into multiple columns.

WHStack {
  Text("Wrapping…").fixedSize().padding()
  Color.red.frame(height: 200).overlay(Text("1"))
  Color.green.frame(height: 200).overlay(Text("2"))
  Color.blue.frame(height: 200).overlay(Text("3"))
  Color.yellow.frame(height: 200).overlay(Text("4"))
  Text("…content").fixedSize().padding()
}

More info in the docs.

Installation via SPM

In XCode add the following URL to your project's Swift Package dependencies:

https://github.com/swiftuilib/wrap-stack

Development

To modify the package contents while still being able to see SwiftUI Previews use the provided WrapStackPreview.xcodeproj.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 100.0%