TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Is it possible to make a list with sections that scroll like normal rows?

Forums > SwiftUI

I mean not floating sections.

Apparently you can do that to tableviews by using this code

let dummyViewHeight = CGFloat(40)
self.tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: self.tableView.bounds.size.width, height: dummyViewHeight))
self.tableView.contentInset = UIEdgeInsets(top: -dummyViewHeight, left: 0, bottom: 0, right: 0)

Any ideas for SwiftUI?

Thanks in advance.

3      

By scroll like normal do you mean that they are basically rows with different backrounds and fonts etc? You could fairly easily roll your own on that.

3      

Yes but that would be a hack, and no so beautiful. I mean, I would like them to continue to be sections but to be fixed in place, like titles for the rows of their sections, without floating and hanging at the top.

3      

Whats hacky about it? Section is defined as

public struct Section<Parent, Content, Footer> {

which means you have to supply the internal content youself and SwiftUI will make sure the section floats, or be collapsable. So you provide your own UI either way.

3      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.