Swiftpack.co - reuschj/RotatableStack as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by reuschj.
reuschj/RotatableStack 1.0.1
A SwiftUI view that embeds in a VStack when in portrait orientation and HStack in landscape orientation. It wraps your content in a GeometryReader to determine if the device is in landscape or portrait rotation (or on larger devices, if it's generally wider or narrower). If portrait, it wraps the content in a VStack, else it wraps in an HStack for landscape.
⭐️ 5
🕓 1 week ago
.package(url: "https://github.com/reuschj/RotatableStack.git", from: "1.0.1")

RotatableStack

A SwiftUI view that embeds in a VStack when in portrait orientation and HStack in landscape orientation. It wraps your content in a GeometryReader to determine if the device is in landscape or portrait rotation (or on larger devices, if it's generally wider or narrower). If portrait, it wraps the content in a VStack, else it wraps in an HStack for landscape.

Basic Usage

Use RotatableStack in place of a VStack or HStack where you want the layout to change based on the geometry of your device:

struct MyView: View {

    var body: some View {
        RotatableStack {
            Spacer()
            Text("Hello, World!")
        }
    }
}

GitHub

link
Stars: 5
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

WatchOS Support
1 week ago

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