intuit / intuit/CardParts

CardParts Cannot be shared across states

Open
#213 0 comments 0 reactions 0 assignees View on GitHub
bug
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.