24 lines
		
	
	
		
			598 B
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			598 B
		
	
	
	
		
			Swift
		
	
	
	
	
	
import SwiftUI
 | 
						|
 | 
						|
struct PostFeedView: View {
 | 
						|
    let posts: [Post]
 | 
						|
    let selectedPostID: UUID
 | 
						|
 | 
						|
    var body: some View {
 | 
						|
        ScrollViewReader { proxy in
 | 
						|
            ScrollView {
 | 
						|
                LazyVStack(spacing: 24) {
 | 
						|
                    ForEach(posts) { post in
 | 
						|
                        PostDetailView(post: post)
 | 
						|
                            .id(post.id)
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            }
 | 
						|
            .navigationBarTitle("Feed", displayMode: .inline)
 | 
						|
            .onAppear {
 | 
						|
                proxy.scrollTo(selectedPostID, anchor: .center)
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |