mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-11 22:55:55 +05:45
Apple changed `xrOS` to `visionOS` on the latest beta. Looks like this was already supported in prior `Xcode 15.1` betas, so this doesn't break compatibility with them.
37 lines
977 B
Swift
37 lines
977 B
Swift
//
|
|
// AdaptiveStack.swift
|
|
// PurchaseTester
|
|
//
|
|
// Created by Nacho Soto on 6/22/23.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct AdaptiveStack<Content: View>: View {
|
|
|
|
let horizontalAlignment: HorizontalAlignment
|
|
let verticalAlignment: VerticalAlignment
|
|
let spacing: CGFloat?
|
|
let content: () -> Content
|
|
|
|
init(
|
|
horizontalAlignment: HorizontalAlignment = .center,
|
|
verticalAlignment: VerticalAlignment = .center,
|
|
spacing: CGFloat? = nil,
|
|
@ViewBuilder content: @escaping () -> Content
|
|
) {
|
|
self.horizontalAlignment = horizontalAlignment
|
|
self.verticalAlignment = verticalAlignment
|
|
self.spacing = spacing
|
|
self.content = content
|
|
}
|
|
|
|
var body: some View {
|
|
#if os(visionOS)
|
|
VStack(alignment: self.horizontalAlignment, spacing: self.spacing, content: self.content)
|
|
#else
|
|
HStack(alignment: self.verticalAlignment, spacing: spacing, content: self.content)
|
|
#endif
|
|
}
|
|
}
|