Skip to content

Instantly share code, notes, and snippets.

@SwiftyAlex
Created April 7, 2020 18:46
Show Gist options
  • Save SwiftyAlex/c1ff7cecb87fc3fb2146cc75beb05d45 to your computer and use it in GitHub Desktop.
Save SwiftyAlex/c1ff7cecb87fc3fb2146cc75beb05d45 to your computer and use it in GitHub Desktop.
// New View
struct PodcastScrollView: View {
var content: [Podcast]
var body: some View {
ScrollView(.horizontal) {
HStack {
ForEach(content, id: \.self) { _ in
RoundedRectangle(cornerRadius: 22, style: .continuous)
.foregroundColor(Color.blue)
.frame(width: 120, height: 120)
}
Spacer()
}
.padding()
}
}
}
// Home View
struct HomeView: View {
let featuredPodcasts: [Podcast]
let popularPodcasts: [Podcast]
let yourPodcasts: [Podcast]
var body: some View {
NavigationView {
VStack(alignment: .leading) {
Text("Welcome to SwiftUI")
.font(.subheadline)
.bold()
.padding()
PodcastScrollView(content: featuredPodcasts)
PodcastScrollView(content: popularPodcasts)
PodcastScrollView(content: yourPodcasts)
Spacer()
}
.navigationBarTitle("Home")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment