Skip to content

Commit

Permalink
safeAreaInset sample
Browse files Browse the repository at this point in the history
  • Loading branch information
TahaTesser committed Sep 26, 2024
1 parent 4adcfed commit a325f56
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
Binary file not shown.
2 changes: 2 additions & 0 deletions SwiftUIPlayground/Samples.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public let samples: [String: AnyView] = [
[
// https://developer.apple.com/documentation/swiftui/view/containerrelativeframe(_:alignment:)
"Container Relative Frame": AnyView(ContainerRelativeFrameSample()),
// https://developer.apple.com/documentation/swiftui/view/safeareainset(edge:alignment:spacing:content:)-6gwby
"safeAreaInset": AnyView(SafeAreaInsetSample()),
]
)),
"Drawing and Graphics": AnyView(SamplesList(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// SafeAreaInsetSample.swift
// SwiftUIPlayground
//
// Created by Taha Tesser on 27.09.2024.
//

import SwiftUI

struct SafeAreaInsetSample: View {
var body: some View {
NavigationStack {
List {
Text("One")
Text("Two")
Text("Three")
}
.navigationTitle("Safe Area Inset")
.navigationBarTitleDisplayMode(.inline)
.safeAreaInset(edge: .top, spacing: 0) {
HStack {
Spacer() // Pushes the Menu to the trailing end

Menu {
Button("Set In Point", action: {})
Button("Set Out Point", action: {})
} label: {
Label("Editing", systemImage: "ellipsis.circle")
.font(.headline)
.foregroundColor(.blue)
}
}
.padding(.horizontal)
}
}
}
}

#Preview {
SafeAreaInsetSample()
}

0 comments on commit a325f56

Please sign in to comment.