Skip to content

Commit a0e2045

Browse files
committed
Deprecated HStackFULayout, VStackFULayout and ZStackFULayout
Updated readme
1 parent e70e530 commit a0e2045

4 files changed

Lines changed: 50 additions & 21 deletions

File tree

README.md

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ A collection of SwiftUI tools to help with layout.
1616
- [Frame Adjustment](#frame-adjustment) tools like [`WidthReader`](#widthreader), [`HeightReader`](#heightreader), [`onSizeChange(perform:)`](#onsizechangeperform), [`keyboardHeight`](#keyboardHeight), [`.relativePadding`](#relativepaddingedges-lengthfactor), [`ScaledView`](#scaledview) and [`OverlappingImage`](#overlappingimage).
1717
- [unclippedTextRenderer](#unclippedtextrenderer) for fixing clipped `Text`.
1818
- [`SmartScrollView`](#smartscrollview) with optional scrolling, a content-fitable frame, and live edge inset values.
19-
- [`TwoSidedView`](#twosidedview) and [`FlippingView`](#flippingview) for making flippable views with a different view on the back side.
19+
- [`FlippingView`](#flippingview) and [`rotation3DEffect(back:)`](#rotation3deffectback) for making flippable views with a different view on the back side.
2020
- [`TabMenu`](#tabmenu), a customizable iOS tab menu with `onReselect` and `onDoubleTap` functions.
2121

2222
Some widget-related tools
@@ -367,7 +367,23 @@ SmartScrollView(.vertical, showsIndicators: true, optionalScrolling: true, shrin
367367
- If placed directly inside a NavigationView with a resizing header, this view may behave strangely when scrolling. To avoid this add 1 point of padding just inside the NavigationView.
368368
- If the available space for this view grows for any reason other than screen rotation, this view might not grow to fill the space.
369369

370-
## TwoSidedView
370+
## FlippingView
371+
372+
### FlippingView
373+
A two-sided view that can be flipped by tapping or swiping.
374+
375+
The axis, anchor, perspective, drag distance to flip, animation for tap to flip and more can all be customized.
376+
377+
For visionOS a slightly different initializer might be needed and the flips will occur in 3d space. If instead you want a perspective effect on a flat view you can use `PerspectiveFlippingView`
378+
379+
```swift
380+
FlippingView(flips: $flips) {
381+
Color.blue.overlay(Text("Up"))
382+
} back: {
383+
Color.red.overlay(Text("Back"))
384+
}
385+
```
386+
371387
### rotation3DEffect(angle:axis:anchor:anchorZ:perspective:backsideFlip:back:)
372388
*\*deprecated in visionOS*
373389
Renders a view’s content as if it’s rotated in three dimensions around the specified axis with a closure containing a different view to show on the back.
@@ -381,41 +397,27 @@ Color.blue.overlay(Text("Front"))
381397
}
382398
```
383399

384-
### perspectiveRotationEffect(angle:axis:anchor:anchorZ:perspective:backsideFlip:back:)
400+
### rotation3DEffect(angle:axis:anchor:backsideFlip:back:)
385401
*\*visionOS*
386-
Renders a view’s content as if it’s rotated in three dimensions around the specified axis with a closure containing a different view to show on the back. The view is not actually rotated in 3d space.
387-
402+
Rotates this view’s rendered output in three dimensions around the given axis of rotation with a closure containing a different view on the back. A minimum thickness that offsets the two views is required to ensure the side facing the user renders on top.
388403
```swift
389404
Color.blue.overlay(Text("Front"))
390405
.rotation3DEffect(angle) {
391406
Color.red.overlay(Text("Back"))
392407
}
393408
```
394409

395-
### rotation3DEffect(angle:axis:anchor:backsideFlip:back:)
410+
### perspectiveRotationEffect(angle:axis:anchor:anchorZ:perspective:backsideFlip:back:)
396411
*\*visionOS*
397-
Rotates this view’s rendered output in three dimensions around the given axis of rotation with a closure containing a different view on the back. A minimum thickness that offsets the two views is required to ensure the side facing the user renders on top.
412+
Renders a view’s content as if it’s rotated in three dimensions around the specified axis with a closure containing a different view to show on the back. The view is not actually rotated in 3d space.
413+
398414
```swift
399415
Color.blue.overlay(Text("Front"))
400416
.rotation3DEffect(angle) {
401417
Color.red.overlay(Text("Back"))
402418
}
403419
```
404420

405-
406-
### FlippingView
407-
A two-sided view that can be flipped by tapping or swiping.
408-
409-
The axis, anchor, perspective, drag distance to flip, animation for tap to flip and more can all be customized.
410-
411-
```swift
412-
FlippingView(flips: $flips) {
413-
Color.blue.overlay(Text("Up"))
414-
} back: {
415-
Color.red.overlay(Text("Back"))
416-
}
417-
```
418-
419421
## TabMenu
420422
*\*iOS only*
421423

@@ -523,6 +525,7 @@ If you like the SwiftUI `Layout` protocol but you need to target an older OS tha
523525
An `FULayout` will work in the same way as a SwiftUI `Layout`. The main difference is it will require a `maxWidth` or `maxHeight` parameter when initializing in order to know the available space. This can be provided by `GeometryReader` or with [`WidthReader`](#widthreader) or [`HeightReader`](#heightreader) from this package.
524526

525527
### ViewBuilder
528+
*\*Deprecated iOS 16, macOS 13, watchOS 7, tvOS 14, visionOS 1*
526529
An `FULayout` uses `callAsFunction()` with a view builder so you can use it just like a SwiftUI `Layout`.
527530

528531
```swift
@@ -535,6 +538,7 @@ VFlow(maxWidth: 200) {
535538
*Caution: This method uses Apple's private protocol `_VariadicView` under the hood. There is a small risk Apple could change the implementation so if this concerns you, use method 2 below.*
536539

537540
### `.forEach()`
541+
*\*Deprecated iOS 16, macOS 13, watchOS 7, tvOS 14, visionOS 1*
538542
This method works in a very similar way to `ForEach()`.
539543

540544
```swift
@@ -546,6 +550,7 @@ MyFULayout().forEach(["Hello", "World"], id: \.self) { item in
546550

547551
## FULayouts
548552
### HFlow
553+
*\*Deprecated iOS 16, macOS 13, watchOS 7, tvOS 14, visionOS 1*
549554
The [`FULayout`](#fulayout) equivalent of [`HFlowLayout`](#hflowlayout).
550555

551556
A FrameUp `FULayout` that arranges views in horizontal rows flowing from one to the next with adjustable horizontal and vertical spacing and support for horiztonal and vertical alignment including a justified alignment that will space elements in completed rows evenly.
@@ -563,6 +568,7 @@ WidthReader { width in
563568
```
564569

565570
### VFlow
571+
*\*Deprecated iOS 16, macOS 13, watchOS 7, tvOS 14, visionOS 1*
566572
The [`FULayout`](#fulayout) equivalent of [`VFlowLayout`](#vflowlayout).
567573

568574
A FrameUp `FULayout` that arranges views in vertical columns flowing from one to the next with adjustable horizontal and vertical spacing and support for horiztonal and vertical alignment including a justified alignment that will space elements in completed columns evenly.
@@ -580,6 +586,7 @@ WidthReader { width in
580586
```
581587

582588
### HMasonry
589+
*\*Deprecated iOS 16, macOS 13, watchOS 7, tvOS 14, visionOS 1*
583590
The [`FULayout`](#fulayout) equivalent of [`HMasonryLayout`](#hmasonrylayout).
584591

585592
A FrameUp `FULayout` that arranges views into a set number of rows by adding each view to the shortest row.
@@ -596,6 +603,7 @@ HeightReader { height in
596603
```
597604

598605
### VMasonry
606+
*\*Deprecated iOS 16, macOS 13, watchOS 7, tvOS 14, visionOS 1*
599607
The [`FULayout`](#fulayout) equivalent of [`VMasonryLayout`](#vmasonrylayout).
600608

601609
A FrameUp `FULayout` that arranges views into a set number of rows by adding each view to the shortest row.
@@ -612,6 +620,7 @@ WidthReader { width in
612620
```
613621

614622
### FULayoutThatFits
623+
*\*Deprecated iOS 16, macOS 13, watchOS 7, tvOS 14, visionOS 1*
615624
The [`FULayout`](#fulayout) equivalent of [`LayoutThatFits`](#layoutthatfits).
616625

617626
An `FULayout` that picks the first provided layout that will fit the content in the provided maxWidth, maxHeight, or both. This is most helpful when switching between `HStackFULayout` and `VStackFULayout` as the content only needs to be provided once and will even animate when the stack changes.
@@ -631,6 +640,7 @@ FULayoutThatFits(
631640
```
632641

633642
### FUViewThatFits
643+
*\*Deprecated iOS 16, macOS 13, watchOS 7, tvOS 14, visionOS 1*
634644
The [`FULayout`](#fulayout) equivalent of SwiftUI `ViewThatFits`.
635645

636646
An `FULayout` that presents the first view that fits the provided maxWidth, maxHeight, or both depending on which parameters are used.
@@ -656,15 +666,19 @@ WidthReader { width in
656666
Alternative stack layouts that can be wrapped in [`AnyFULayout`](#anyfulayout) and then toggled between with animation. Useful when you want to toggle between VStack and HStack based on available space.
657667

658668
#### HStackFULayout
669+
*\*Deprecated iOS 16, macOS 13, watchOS 7, tvOS 14, visionOS 1*
659670
Similar to `HStack` but `Spacer()` cannot be used and content will always use a fixed size on the horizontal axis.
660671

661672
#### VStackFULayout
673+
*\*Deprecated iOS 16, macOS 13, watchOS 7, tvOS 14, visionOS 1*
662674
Similar to `VStack` but `Spacer()` cannot be used and content will always use a fixed size on the vertical axis.
663675

664676
#### ZStackFULayout
677+
*\*Deprecated iOS 16, macOS 13, watchOS 7, tvOS 14, visionOS 1*
665678
Similar to `ZStack` but content will always use a fixed size on both the vertical and horizontal axes.
666679

667680
### AnyFULayout
681+
*\*Deprecated iOS 16, macOS 13, watchOS 7, tvOS 14, visionOS 1*
668682
The [`FULayout`](#fulayout) equivalent of SwiftUI `AnyLayout`.
669683

670684
A type-erased FrameUp layout can be used to wrap multiple layouts and switch between them with animation.

Sources/FrameUp/FULayout/FULayouts/HStackFULayout.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
import SwiftUI
99

1010
/// A FrameUp layout version of `HStackLayout`. Useful when you want to toggle between different FrameUp layouts.
11+
@available(iOS, introduced: 14, deprecated: 16, message: "HStackFULayout can be replaced with SwiftUI HStackLayout")
12+
@available(macOS, introduced: 11, deprecated: 13, message: "HStackFULayout can be replaced with SwiftUI HStackLayout")
13+
@available(watchOS, introduced: 7, deprecated: 9, message: "HStackFULayout can be replaced with SwiftUI HStackLayout")
14+
@available(tvOS, introduced: 14, deprecated: 16, message: "HStackFULayout can be replaced with SwiftUI HStackLayout")
15+
@available(visionOS, introduced: 1, deprecated: 1, message: "HStackFULayout can be replaced with SwiftUI HStackLayout")
1116
public struct HStackFULayout: FULayout, Sendable {
1217
typealias Row = FULayoutRow
1318

Sources/FrameUp/FULayout/FULayouts/VStackFULayout.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
import SwiftUI
99

1010
/// A FrameUp layout version of `VStackLayout`. Useful when you want to toggle between different FrameUp layouts.
11+
@available(iOS, introduced: 14, deprecated: 16, message: "VStackFULayout can be replaced with SwiftUI VStackLayout")
12+
@available(macOS, introduced: 11, deprecated: 13, message: "VStackFULayout can be replaced with SwiftUI VStackLayout")
13+
@available(watchOS, introduced: 7, deprecated: 9, message: "VStackFULayout can be replaced with SwiftUI VStackLayout")
14+
@available(tvOS, introduced: 14, deprecated: 16, message: "VStackFULayout can be replaced with SwiftUI VStackLayout")
15+
@available(visionOS, introduced: 1, deprecated: 1, message: "VStackFULayout can be replaced with SwiftUI VStackLayout")
1116
public struct VStackFULayout: FULayout, Sendable {
1217
typealias Column = FULayoutColumn
1318

Sources/FrameUp/FULayout/FULayouts/ZStackFULayout.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
import SwiftUI
99

1010
/// A FrameUp layout version of `ZStackLayout`. Useful when you want to toggle between different FrameUp layouts.
11+
@available(iOS, introduced: 14, deprecated: 16, message: "ZStackFULayout can be replaced with SwiftUI ZStackLayout")
12+
@available(macOS, introduced: 11, deprecated: 13, message: "ZStackFULayout can be replaced with SwiftUI ZStackLayout")
13+
@available(watchOS, introduced: 7, deprecated: 9, message: "ZStackFULayout can be replaced with SwiftUI ZStackLayout")
14+
@available(tvOS, introduced: 14, deprecated: 16, message: "ZStackFULayout can be replaced with SwiftUI ZStackLayout")
15+
@available(visionOS, introduced: 1, deprecated: 1, message: "ZStackFULayout can be replaced with SwiftUI ZStackLayout")
1116
public struct ZStackFULayout: FULayout, Sendable {
1217
public let alignment: FUAlignment
1318
public let maxWidth: CGFloat

0 commit comments

Comments
 (0)