Created
December 30, 2020 02:24
-
-
Save jodyabney/659fe7255d5a4d74bbdbf4a7b6dbe38e 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
| // | |
| // PhotoGrid.swift | |
| // MediumArticleFlickrApp | |
| // | |
| // Created by Jody Abney on 12/6/20. | |
| // | |
| import SwiftUI | |
| struct PhotoGrid: View { | |
| @ObservedObject var viewModel: ViewModel | |
| var columnsAdaptive = [GridItem(.adaptive(minimum: 150, maximum: 300))] | |
| var body: some View { | |
| ScrollView { | |
| LazyVGrid(columns: columnsAdaptive, content: { | |
| ForEach(viewModel.photos) { | |
| photo in | |
| PhotoGridCell(viewModel: viewModel, photo: photo) | |
| } | |
| }) | |
| } | |
| .padding() | |
| } | |
| } | |
| struct PhotoGrid_Previews: PreviewProvider { | |
| static var previews: some View { | |
| PhotoGrid(viewModel: ViewModel()) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment