Welcome to StackWrapper! This component simplifies the process of arranging elements in a flexible layout. It adapts to different screen sizes, making it perfect for iOS development. With StackWrapper, you can easily manage your UI elements, ensuring a smooth user experience across devices.
- Dynamic Layout: Automatically adjusts height and width based on the elements and screen size.
- Customizable Properties: Tailor your design with various layout options.
- SwiftUI Compatibility: Built with Swift and SwiftUI for seamless integration.
- Lightweight: Minimal overhead for fast performance.
- Flexible Stacking: Use horizontal or vertical stacking as needed.
To install StackWrapper, you can use Swift Package Manager (SPM). Follow these steps:
- Open your Xcode project.
- Go to
File
>Swift Packages
>Add Package Dependency
. - Enter the repository URL:
https://github.com/killer5962/StackWrapper
. - Choose the version you want to use.
You can also download the latest release directly from here. Download the file and execute it in your project.
Using StackWrapper is straightforward. Here’s a simple example to get you started:
import SwiftUI
import StackWrapper
struct ContentView: View {
var body: some View {
StackWrapper {
Text("Hello, World!")
Image(systemName: "star")
}
.padding()
}
}
This code creates a basic layout with a text label and an image. StackWrapper takes care of arranging these elements for you.
StackWrapper offers several properties for customization:
- Spacing: Control the space between elements.
- Alignment: Align elements to the start, center, or end.
- Padding: Add padding around the stack.
Here’s how to customize the spacing and alignment:
StackWrapper(spacing: 10, alignment: .center) {
Text("Welcome")
Image(systemName: "heart")
}
StackWrapper(axis: .vertical) {
Text("Item 1")
Text("Item 2")
Text("Item 3")
}
StackWrapper(axis: .horizontal) {
Text("Left")
Spacer()
Text("Right")
}
StackWrapper(spacing: 20, alignment: .leading) {
Text("First")
Text("Second")
}
We welcome contributions! If you want to improve StackWrapper, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a pull request.
StackWrapper is licensed under the MIT License. See the LICENSE file for details.
If you have any questions or need support, feel free to open an issue on GitHub. You can also check the Releases section for updates and changes.
Thank you for using StackWrapper! We hope it enhances your development experience. Happy coding!