Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CardParts Cannot be shared across states #213

Open
muzoman opened this issue Dec 19, 2019 · 0 comments
Open

CardParts Cannot be shared across states #213

muzoman opened this issue Dec 19, 2019 · 0 comments
Labels
bug Something isn't working

Comments

@muzoman
Copy link

muzoman commented Dec 19, 2019

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: <CardParts.CardCell: 0x7fa827c48b10; baseClass = UICollectionViewCell; frame = (10 0; 394 0); layer = <CALayer: 0x6000029e8740>>

@muzoman muzoman added the bug Something isn't working label Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant