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
You can try this. Replace with your frame
var draggable = DraggableViewBackground(frame: CGRectMake(0, 0, 100, 100))
self.view.addSubview(draggable)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.