0

How I can convert this Objective-C format into Swift? I already create a bridging header called Bridging-Header.h.

I already import this library header into bridging header.

#import "DraggableView.h"
#import "DraggableViewBackground.h"
#import "OverlayView.h"

Then I want to convert this Objective-C thing into swift.

DraggableViewBackground *draggableBackground = [[DraggableViewBackground alloc]initWithFrame:self.view.frame];
    [self.view addSubview:draggableBackground];

What I already done so far, I call the object DraggableViewBackground from DraggableViewBackground.h in my ViewController.swift.

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.

        var instanceOfDraggableViewBackground: DraggableViewBackground = DraggableViewBackground()

    }
}

Reference library: https://github.com/cwRichardKim/TinderSimpleSwipeCards

Christophe
  • 68,716
  • 7
  • 72
  • 138
Nurdin
  • 23,382
  • 43
  • 130
  • 308

1 Answers1

0

You can try this. Replace with your frame

var draggable = DraggableViewBackground(frame: CGRectMake(0, 0, 100, 100))
self.view.addSubview(draggable)
rakeshbs
  • 24,392
  • 7
  • 73
  • 63