Comments (5)
Thanks!
Sorry, I'm not sure I understood your question.
Are you talking about the elements of the grid? Do you have an example of what you are trying to achieve?
from waterfallgrid.
Hi Paolo. Sorry, my question was not so clear! : )
I mean to use some Text or Rectangle to prototype a grid without data, when you are in early stage of designing the UI and don't have data yet.
Example bellow with a List
import SwiftUI
struct ListView: View {
var body: some View {
List {
Rectangle()
Text("Hello, World!")
}
}
}
struct ListView_Previews: PreviewProvider {
static var previews: some View {
ListView()
}
}
`
from waterfallgrid.
Oh, I see! Currently is not possible.
But it's a feature that I would definitely like to include.
The Grid initializer needs to be updated in a way that can accept @ViewBuilder
as a parameter.
https://developer.apple.com/documentation/swiftui/viewbuilder
from waterfallgrid.
thanks Paolo! I managed to make it work, and now I am trying to make a button that Swtches between List and your Grid.
I posted a question on Stack Overflow. Do you know how to do it?
https://stackoverflow.com/questions/59145490/swiftui-switch-between-list-and-grid-collection-view
from waterfallgrid.
I believe they already pointed you in the right direction.
The problem with your code is the return type different from the expected some View
.
One solution is to move the if-else
statement inside a "container" like Group
, the opaque View generated won't change no matter the state of the boolean.
From there you can call .navigationBarTitle
, .navigationBarItems
etc. without compile errors.
NavigationView {
Group {
if showgrid == true {
WaterfallGrid(...)
} else {
List(...)
}
}
.navigationBarTitle(...)
.navigationBarItems(...)
}
from waterfallgrid.
Related Issues (20)
- Support for async images with placeholder?
- Getting Cannot convert value of type 'some View' to closure result type '_' HOT 3
- iOS 14 HOT 6
- Can I use in Rxswift?
- Grid missing inside scrollview HOT 2
- Can't see on Canvas, on in Preview Mode HOT 1
- Bound preference ElementPreferenceKey tried to update multiple times per frame HOT 3
- Waterfall Grid Sample App not displaying full content in CardsGrid when 1 or 2 assets in grid HOT 3
- Invalid frame dimension (negative or non-finite) HOT 2
- Use Kingfisher on the waterfall grid
- Cannot find 'WaterfallGrid' in scope
- Grid 1 HOT 1
- Nondeterministic layout bug HOT 5
- The size of the picture is not displayed properly in the waterfall flow HOT 2
- How to solve the lazy loading problem, very stuck HOT 1
- Problem with pagination / Load more
- Span over columns HOT 1
- If there are less than two images to be displayed, nothing will be displayed. HOT 3
- Item sizes are all the same in Column / Horizontal Layout
- unable to show all imgs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from waterfallgrid.