apptekstudios / ASCollectionView

A SwiftUI collection view with support for custom layouts, preloading, and more.
MIT License
1.35k stars 161 forks source link

Width of the ASCollection View Tags #217

Closed GermanZvezdin closed 3 years ago

GermanZvezdin commented 3 years ago

Describe the error The problem is that the width of the AS Collection View Tags is larger than its content these greatly complicate the creation of a border for this view

For Playback Create ASCollection View Tags from the Demo add text inside and make a border for it

Expected behavior The width of ASCollection View Tags will be greater than the width of its content

Screenshots

Снимок экрана 2021-07-17 в 19 42 32

The border is highlighted in orange and the content itself is three words 'i are here' P. S. I know that this is a grammatical error

Xcode Version: -12.5.1

Simulator, Device, Both?

apptekstudios commented 3 years ago

I think you are possibly misunderstanding the order of modifiers in SwiftUI. The demo project uses the following code:

ASCollectionViewSection(id: 0, data: store.items) { item, _ in
  Text(item.displayString)
      .fixedSize(horizontal: false, vertical: true)
      .padding(5) // ← padding around the text
      .background(Color(.systemGray))
      .cornerRadius(5)
}

Note that the padding and gray border are added in SwiftUI and are not part of ASCollectionView