CopyPastor

Detecting plagiarism made easy.

Score: 0.8006422544716436; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2024-09-02
by Joule87

Original Post

Original - Posted on 2021-02-11
by TruMan1



            
Present in both answers; Present only in the new answer; Present only in the old answer;

You can achive that using **GeometryReader**, here you have a demo:
import SwiftUI struct ContentView: View { @State private var list: [Int] = [0,1,2,3,4,5] var body: some View { GeometryReader { geometry in ScrollView { VStack(spacing: 0) { ForEach(list, id: \.self) { index in Button(action: { list.removeAll(where: { $0 == index}) }, label: { Text("Item #\(index)") .padding() .frame(maxWidth: .infinity, alignment: .leading) .border(.gray, width: 0.2) }) } Spacer() bottomView } .frame(minHeight: geometry.size.height) } } } private var bottomView: some View { HStack { Spacer() Button(action: { list.append(list.count + 1) }, label: { Text("Fixed Bottom Section") .padding() }) Spacer() } .background(Color.gray.opacity(0.2)) } } #Preview { ContentView() }
[![enter image description here][1]][1]

[1]: https://i.sstatic.net/oT5cqPaA.gif
You can use `overlay` on the `List`:
struct ContentView: View { @State private var selectedTab = 0 var body: some View { TabView(selection: $selectedTab) { VStack { List { ForEach(0..<20, id: \.self) { _ in Section { Text("Item 1") Text("Item 2") Text("Item 3") } } } .listStyle(InsetGroupedListStyle()) .overlay( VStack { Spacer() Text("Updated at: 5:26 AM") .font(.footnote) .foregroundColor(.secondary) .frame(maxWidth: .infinity) } ) } .tabItem { Label("First", systemImage: "alarm") } Text("Content 2") .tabItem { Label("Second", systemImage: "calendar") } } } }

        
Present in both answers; Present only in the new answer; Present only in the old answer;