CardParts Cannot be shared across states
- Dominant language
- Swift
- Stars
- 2.5k
- Forks
- 221
- PR merge metrics
- No merged PRs in 30d
Description
If a CardPart is created and then used in multiple calls to setupCardParts forState then upon first display the shared CardPart is not displayed.
I amended the example StateCardController thus:
`
override func viewDidLoad() {
super.viewDidLoad()
self.state = .empty
let sharedPart = CardPartTextView(type: .normal)
sharedPart.text = "Shared Card Part"
let textPart = CardPartTextView(type: .normal)
textPart.text = "Empty State"
let loadingCardPart = CardPartTextView(type: .normal)
loadingCardPart.text = "I am a loading state part"
let customCardPart = CardPartTextView(type: .normal)
customCardPart.text = "I am a custom state that you can make!"
setupCardParts([customCardPart, sharedPart], forState: .custom(customStateKey))
setupCardParts([textPart, sharedPart], forState: .empty)
setupCardParts([loadingCardPart, sharedPart], forState: .loading)
}`
If the state is changed then the card parts are then correctly displayed but there's an XCode warning triggered:
`CardParts_Example[20068:4559504] [Warning] Warning once only: Detected a case where constraints ambiguously suggest a size of zero for a collection view cell's content view. We're considering the collapse unintentional and using standard size instead. Cell: >`
Contributor guide
Assessment
This issue has not been assessed yet.