Skip to content

Commit

Permalink
0.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nathantannar4 committed Jan 25, 2023
1 parent d5e0660 commit fba6c6b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/nathantannar4/Engine", from: "0.1.4"),
.package(url: "https://github.com/nathantannar4/Engine", from: "0.1.5"),
],
targets: [
.target(
Expand Down
23 changes: 20 additions & 3 deletions Sources/Turbocharger/Sources/View/AdaptiveStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Engine
/// would fit the available space. If there is not enough space, it arranges it's subviews
/// in a vertical line.
@frozen
public struct AdaptiveStack<Content: View>: VersionedView {
public struct AdaptiveStack<Content: View>: View {

public var alignment: Alignment
public var spacing: CGFloat?
Expand Down Expand Up @@ -42,8 +42,25 @@ public struct AdaptiveStack<Content: View>: VersionedView {
self.content = content()
}

public var body: some View {
AdaptiveStackBody(
alignment: alignment,
spacing: spacing,
content: content,
axis: axis
)
}
}

private struct AdaptiveStackBody<Content: View>: VersionedView {

var alignment: Alignment
var spacing: CGFloat?
var content: Content
var axis: Axis

@available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *)
public var v4Body: some View {
var v4Body: some View {
LayoutAdapter {
switch axis {
case .vertical:
Expand All @@ -60,7 +77,7 @@ public struct AdaptiveStack<Content: View>: VersionedView {
}
}

public var v1Body: some View {
var v1Body: some View {
HVStack(axis: axis, alignment: alignment, spacing: spacing) {
content
}
Expand Down

0 comments on commit fba6c6b

Please sign in to comment.