Swiftpack.co - alexito4/EquallySpacedStack as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by alexito4.
alexito4/EquallySpacedStack 0.1.0
Equally Spaced Stacks for SwiftUI
⭐️ 21
πŸ•“ 4 years ago
iOS
.package(url: "https://github.com/alexito4/EquallySpacedStack.git", from: "0.1.0")

EquallySpacedStack

This package provides two new Views: EquallySpacedHStack and EquallySpacedVStack. They behave like their respective Stacks but distribute the subviews by adding equal space between them.

Status

This package is work in progress. I'm still trying to figure out the best way of doing custom layouts in SwiftUI.

If you want to follow the process you can read my blog or follow me on Twitter:

Usage

Just replace HStack or VStack with EquallySpacedHStack or EquallySpacedVStack:

EquallySpacedHStack {
    Color.red.frame(width: 50, height: 50)
    Color.blue.frame(width: 50, height: 50)
    Color.green.frame(width: 50, height: 50)
}

you can also use ForEach:

EquallySpacedHStack {
    ForEach(1...4) { _ in
        Color.red.frame(width: 50, height: 50)
    }
}

WIP

  • ☐ Avoid issue when using more than the supported number of nested subviews.
  • ☐ Support more nested subviews (max is now 4)
  • ☐ Avoid using the type erased AnyView

Contributions & support

This project is developed completely in the open, and your contributions are more than welcome.

This project does not come with GitHub Issues-based support, and users are instead encouraged to become active participants in its continued development β€” by fixing any bugs that they encounter, or improving the documentation wherever it’s found to be lacking.

If you wish to make a change, open a Pull Request β€” even if it just contains a draft of the changes you’re planning, or a test that reproduces an issue β€” and we can discuss it further from there.

Author

Alejandro Martinez | http://alejandromp.com | @alexito4

GitHub

link
Stars: 21
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

4 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics