Skip to content

Instantly share code, notes, and snippets.

@dmytro-anokhin
Last active August 20, 2020 12:13
Show Gist options
  • Save dmytro-anokhin/13dc5925f2a1d556abe3eadf38edb9bd to your computer and use it in GitHub Desktop.
Save dmytro-anokhin/13dc5925f2a1d556abe3eadf38edb9bd to your computer and use it in GitHub Desktop.
import SwiftUI
import RemoteContentView
struct Post : Codable {
var id: Int
// ...
}
struct PostView : View {
// ...
}
struct PostsView : View {
var body: some View {
let content = DecodableRemoteContent(url: URL(string: "https://jsonplaceholder.typicode.com/posts")!,
type: [Post].self)
return RemoteContentView(remoteContent: content) {
List($0, id: \Post.id) {
PostView(post: $0)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment