Skip to content

Instantly share code, notes, and snippets.

@aheze
Created March 11, 2024 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aheze/9d667b916c2f631392ec8193e0721a4f to your computer and use it in GitHub Desktop.
Save aheze/9d667b916c2f631392ec8193e0721a4f to your computer and use it in GitHub Desktop.
struct ContentView: View {
let imageNames = ["A", "B", "C"]
var body: some View {
ScrollView {
VStack {
ForEach(imageNames, id: \.self) { imageName in
PostView(imageName: imageName)
}
}
}
}
}
struct PostView: View {
var imageName: String
var body: some View {
VStack {
Text("Test")
Color.clear
.overlay {
Image(imageName)
.resizable()
.aspectRatio(contentMode: .fill)
}
.clipped()
.frame(height: 200)
HStack {
Button("Like") {}
Button("Dislike") {}
Button("Comment") {}
Button("Share") {}
}
}
}
}
@aheze
Copy link
Author

aheze commented Mar 11, 2024

Screenshot 2024-03-11 at 4 10 48 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment