1
Fork 0

Decode post's media and decode url

This commit is contained in:
redstrate 2020-06-03 21:56:33 -04:00
parent f7372d6473
commit ba52620710
2 changed files with 14 additions and 0 deletions

View file

@ -4,6 +4,12 @@ enum PostType: String, Decodable {
case picture
}
struct Media: Decodable, Identifiable {
let id: Int
let url: String
}
struct Post: Decodable, Identifiable {
let id: Int
@ -11,4 +17,6 @@ struct Post: Decodable, Identifiable {
let content: String
let postType: PostType
let media: [Media]
}

View file

@ -14,6 +14,12 @@ struct ProfileView: View {
if post.title != nil {
Text(post.title!)
}
VStack {
ForEach(post.media) { media in
Text(media.url)
}
}
}
}
}.navigationBarTitle(username + "'s Feed").onAppear {