Deprecates API that is now included in SwiftUIPlus
This commit is contained in:
parent
556d42f391
commit
afac0c36c4
|
@ -1,7 +1,10 @@
|
||||||
import SwiftBackports
|
import SwiftBackports
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
/// A geometry reader that automatically sizes its height to 'fit' its content.
|
@available(iOS, unavailable, message: "This has been moved to SwiftUIPlus. You should move to the new package which automatically includes all backports as well 👍")
|
||||||
|
@available(macOS, unavailable, message: "This has been moved to SwiftUIPlus. You should move to the new package which automatically includes all backports as well 👍")
|
||||||
|
@available(tvOS, unavailable, message: "This has been moved to SwiftUIPlus. You should move to the new package which automatically includes all backports as well 👍")
|
||||||
|
@available(watchOS, unavailable, message: "This has been moved to SwiftUIPlus. You should move to the new package which automatically includes all backports as well 👍")
|
||||||
public struct FittingGeometryReader<Content>: View where Content: View {
|
public struct FittingGeometryReader<Content>: View where Content: View {
|
||||||
|
|
||||||
@State private var height: CGFloat = 10 // must be non-zero
|
@State private var height: CGFloat = 10 // must be non-zero
|
|
@ -0,0 +1,30 @@
|
||||||
|
import SwiftBackports
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
@available(iOS, unavailable, message: "This has been moved to SwiftUIPlus and renamed to VScrollStack. You should move to the new package which automatically includes all backports as well 👍", renamed: "VScrollStack")
|
||||||
|
@available(macOS, unavailable, message: "This has been moved to SwiftUIPlus and renamed to VScrollStack. You should move to the new package which automatically includes all backports as well 👍", renamed: "VScrollStack")
|
||||||
|
@available(tvOS, unavailable, message: "This has been moved to SwiftUIPlus and renamed to VScrollStack. You should move to the new package which automatically includes all backports as well 👍", renamed: "VScrollStack")
|
||||||
|
@available(watchOS, unavailable, message: "This has been moved to SwiftUIPlus and renamed to VScrollStack. You should move to the new package which automatically includes all backports as well 👍", renamed: "VScrollStack")
|
||||||
|
public struct FittingScrollView<Content: View>: View {
|
||||||
|
private let content: Content
|
||||||
|
private let showsIndicators: Bool
|
||||||
|
|
||||||
|
public init(showsIndicators: Bool = true, @ViewBuilder content: () -> Content) {
|
||||||
|
self.showsIndicators = showsIndicators
|
||||||
|
self.content = content()
|
||||||
|
}
|
||||||
|
|
||||||
|
public var body: some View {
|
||||||
|
GeometryReader { geo in
|
||||||
|
SwiftUI.ScrollView(showsIndicators: showsIndicators) {
|
||||||
|
VStack(spacing: 10) {
|
||||||
|
content
|
||||||
|
}
|
||||||
|
.frame(
|
||||||
|
maxWidth: geo.size.width,
|
||||||
|
minHeight: geo.size.height
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,31 +0,0 @@
|
||||||
import SwiftBackports
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
/// A scrollview that behaves more similarly to a `VStack` when its content size is small enough.
|
|
||||||
public struct FittingScrollView<Content: View>: View {
|
|
||||||
private let content: Content
|
|
||||||
private let showsIndicators: Bool
|
|
||||||
|
|
||||||
/// A new scrollview
|
|
||||||
/// - Parameters:
|
|
||||||
/// - showsIndicators: If true, the scroll view will show indicators when necessary
|
|
||||||
/// - content: The content for this scroll view
|
|
||||||
public init(showsIndicators: Bool = true, @ViewBuilder content: () -> Content) {
|
|
||||||
self.showsIndicators = showsIndicators
|
|
||||||
self.content = content()
|
|
||||||
}
|
|
||||||
|
|
||||||
public var body: some View {
|
|
||||||
GeometryReader { geo in
|
|
||||||
SwiftUI.ScrollView(showsIndicators: showsIndicators) {
|
|
||||||
VStack(spacing: 10) {
|
|
||||||
content
|
|
||||||
}
|
|
||||||
.frame(
|
|
||||||
maxWidth: geo.size.width,
|
|
||||||
minHeight: geo.size.height
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue