Created
April 7, 2020 18:46
-
-
Save SwiftyAlex/c1ff7cecb87fc3fb2146cc75beb05d45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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