ios – Take away padding when utilizing UIHostingConfiguration in cell?







I’m attempting to determine take away the padding I get after I use UIHostingConfiguration to make use of a SwiftUI view in a UICollectionView. For instance utilizing this code:

If I add a border to the CellView:

/// Create a cell registration of sort UICollectionViewCell with `ToDoListItem` that can be used to offer the gathering view cells.
/// This can
let cellRegistration = UICollectionView.CellRegistration<UICollectionViewCell, ToDoListItem> { cell, indexPath, merchandise in
    cell.contentConfiguration = UIHostingConfiguration {
        CellView(toDoListItem: merchandise)
            .border(.crimson) // <-- I added this to point out the padding in between I wish to take away....

It reveals the padding I’m speaking about:

enter image description here

I’ve the identical conduct in different initiatives. I need the SwiftUI view inside UIHostingConfiguration closure to fill the whole area of the cell in order that on this case that crimson border would by proper subsequent to the following cell and never have the hole in between cells…

How can I try this?


Share this


What companies are using big data analytics

What do companies use big data for? What companies are using big data analytics. There are a multitude of reasons companies use big data, but...

How to use big data in healthcare

What is data quality and why is it important in healthcare? How to use big data in healthcare. In healthcare, data quality is important for...

How to build a big data platform

What is big data platform? How to build a big data platform. A big data platform is a powerful platform used to manage and analyze...

Recent articles

More like this