Reputation: 2207
I am following this https://reterwebber.wordpress.com/2015/05/02/tinder-swipe-cards-effect-in-swift/
Single UIView --> I move cards all side left right. But Up and Down swipe I want to show user profile.
These are two different UVIiew
var currentLoadedCardsArray = [TinderCard]() // For left and Right UIVIew //it is working fine
var newDetailTardsArray = [ProfileDetailTinderCard]() // For up and Down UIView
var newMergerArray:[UIView] = [] // made new array
left and right are working fine. But I want to show card view swipe Up and Down show that user profile. So I made other View ProfileDetailTinderCard,
Can Some One suggest me For Card view Swipe up or Down how to show user profile.Or Can me provide some tutorial to Swipe up Or Down User Profile.
Upvotes: 0
Views: 325
Reputation: 5823
You have created following code to make your two different array of view. I assume that these two classes (TinderCard
and DetailTinderCard
) are extending UIView.
Now you have described error here regarding
Error can not convert to [any] to expected argument UIView
This means your array must accept only UIView
and you have passing as [Any]. Either create array of Any
or UIView
.
Looks at following code.
var currentLoadedCardsArray = [TinderCard]()
var newDetailTardsArray = [DetailTinderCard]()
var newMergerArray:[UIView] = []
So, you have to update last line of code as following to add card:
var newMergerArray:[Any] = [] // This makes array of UIView
and to create dictionary you need to write key-value coding:
let dict = ["profile":newCard, "DetailProfile":newDetailcard] as [Any]
newMergerArray.append(dict)
This is not proper solution due to dictionary contains [String: UIView]
type of data.
OR
Just following code should work like charm.
var currentLoadedCardsArray = [TinderCard]()
var newDetailTardsArray = [DetailTinderCard]()
var newMergerArray:[[String: UIView]] = []
This will create array of dictionary, where dictionary contains String and UIView as key-value respectively.
let dict = ["profile": newCard, "detailProfile": newDetailcard] as [String: UIView]
newMergerArray.append(dict)
I hope this will help you.
Upvotes: 0