This is how I called the UIView DraggableViewBackground in Obejective C and it is working perfectly but how to do the same in Swift
DraggableViewBackground *draggableBackgroundforurl = [[DraggableViewBackground alloc]initWithFrame:self.view.frame];
My DraggableViewBackground is in Objective C and I want set this as a subview on click of a button
let draggableBackgroundforurl = DraggableViewBackground(frame: self.view.frame);
That should do the trick.
You can look up the difference between let
and var
to decide what works best for your needs in that case. let
can't change, var
can.
From the UIView docs. Just use the normal swift initializer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With