-
Notifications
You must be signed in to change notification settings - Fork 141
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
Append card without UI interference #112
Comments
Hi @LoopingLouieX. You should not be calling Any call to |
Understand! Edit: I mean it's understandable for me if there is just one or two cards in the stack as example. |
Hey @LoopingLouieX, I think I see the issue now. I am considering adding Your code would look something like this: let cardStack = SwipeCardStack()
var cardModels: [CardModel] = [cardModel1, cardModel2 cardModel3]
var cardModelsToAdd: [CardModel] = []
var isAnimating = false {
didSet {
if !isAnimating && !cardModelsToAdd.isEmpty {
cardStack.appendCards(cardModelsToAdd)
cardModelsToAdd.removeAll()
}
}
}
// Call to fetch new card models
func fetchNewCardModels() {
NetworkUtility.fetchCardModels { cardModels in
self.cardModelsToAdd.append(cardModels)
}
}
// MARK: - SwipeCardStackDelegate
func cardStackDidBeginAnimating(_ cardStack: SwipeCardStack) {
isAnimating = true
}
func cardStackDidEndAnimating(_ cardStack: SwipeCardStack) {
isAnimating = false
} Let me know if this would resolve your situation |
Sorry, I didn't find the cardstackdidbiginanimating method,I think I can try the way you say |
It works, but I don't think it's perfect。 |
@LiuSky How did you managed to get this working? |
@LoopingLouieX I'll fork one if you need it |
@LiuSky Thanks for the help! |
https://github.com/LiuSky/Shuffle It works, but I don't think it's perfect。I'm going to deal with dynamic logic when I'm free。@LoopingLouieX |
@LiuSky Thanks a lot! But it's still not perfect.. |
Hi,
from time to time I am appending some cards to the cardStack with the
cardModels.append(newModel)
method.As you have written in the docs i have to update the card stack occasionally.
But if I update the cardstack with
cardStack.reloadData()
in the same moment as a user is dragging the top card in the UI i.e a little bit to the right side so that the overlay is visible (but didn't finished the swipe) then the top card catches back to the middle automatically.Is there any possibility to avoid that ? Maybe reloading the cardstack in the background without interfering the UI?
The text was updated successfully, but these errors were encountered: