Skip to content

Commit f995c99

Browse files
committed
wip
1 parent df3f9ef commit f995c99

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

Examples/Showcase/Showcase/ContentView.swift

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ struct ContentView: View {
1616
NavigationShowcase()
1717
.tabItem { Text("Navigation") }
1818
.tag(2)
19+
PresentationShowcase()
20+
.tabItem { Text("Presentation") }
21+
.tag(3)
1922
#endif
2023
GenericViewShowcase()
2124
.tabItem { Text("Generic View") }
22-
.tag(3)
25+
.tag(4)
2326
SimpleElementsShowcase()
2427
.tabItem { Text("Simple elements") }
25-
.tag(4)
28+
.tag(5)
2629
}
2730
#if os(iOS) || os(tvOS)
2831
.introspect(.tabView, on: .iOS(.v13, .v14, .v15, .v16, .v17), .tvOS(.v13, .v14, .v15, .v16, .v17)) { tabBarController in
@@ -196,6 +199,30 @@ struct NavigationShowcase: View {
196199
}
197200
}
198201

202+
struct PresentationShowcase: View {
203+
@State var isSheetPresented = false
204+
@State var isFullScreenPresented = false
205+
@State var isPopoverPresented = false
206+
207+
var body: some View {
208+
if #available(iOS 14, tvOS 14, *) {
209+
Button("Full Screen Cover", action: { isFullScreenPresented = true })
210+
.fullScreenCover(isPresented: $isFullScreenPresented) {
211+
Button("Dismiss", action: { isFullScreenPresented = false })
212+
#if os(iOS) || os(tvOS)
213+
.introspect(
214+
.fullScreenCover,
215+
on: .iOS(.v14, .v15, .v16, .v17), .tvOS(.v14, .v15, .v16, .v17)
216+
) { presentationController in
217+
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
218+
presentationController.presentedView?.backgroundColor = .blue
219+
}
220+
#endif
221+
}
222+
}
223+
}
224+
}
225+
199226
struct GenericViewShowcase: View {
200227
var body: some View {
201228
VStack(spacing: 10) {

Sources/ViewTypes/FullScreenCover.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ extension IntrospectableViewType where Self == FullScreenCoverType {
5353

5454
#if canImport(UIKit)
5555
extension iOSViewVersion<FullScreenCoverType, UIPresentationController> {
56-
public static let v13 = Self(for: .v13, selector: selector)
56+
@available(*, unavailable, message: ".fullScreenCover isn't available on iOS 13")
57+
public static let v13 = Self.unavailable()
5758
public static let v14 = Self(for: .v14, selector: selector)
5859
public static let v15 = Self(for: .v15, selector: selector)
5960
public static let v16 = Self(for: .v16, selector: selector)
@@ -65,7 +66,8 @@ extension iOSViewVersion<FullScreenCoverType, UIPresentationController> {
6566
}
6667

6768
extension tvOSViewVersion<FullScreenCoverType, UIPresentationController> {
68-
public static let v13 = Self(for: .v13, selector: selector)
69+
@available(*, unavailable, message: ".fullScreenCover isn't available on tvOS 13")
70+
public static let v13 = Self.unavailable()
6971
public static let v14 = Self(for: .v14, selector: selector)
7072
public static let v15 = Self(for: .v15, selector: selector)
7173
public static let v16 = Self(for: .v16, selector: selector)

0 commit comments

Comments
 (0)