Gugulethu February 2016

Rewriting this Line from Objective C to Swift

I know this is a little trivial but for the life of me I can't seem to get this line of Objective-C Code right in Swift.

Any Ideas?

Obj C Code:

CardView *view = (CardView *)draggableView;

I tried:

let view : CardView = draggableView(CardView) 

I'm probably forgetting something small.

Answers


Ajay Kumar February 2016

Try -

let view = draggableView as! CardView 


Siriss February 2016

Try

let view = draggableView as! CardView

That should cast it to a CardView.


Post Status

Asked in February 2016
Viewed 3,482 times
Voted 9
Answered 3 times

Search




Leave an answer