Ios Swift中的桥接头转换
如何将Objective-C格式转换为Swift格式?我已经创建了一个名为Ios Swift中的桥接头转换,ios,objective-c,swift,xcode6,bridging-header,Ios,Objective C,Swift,Xcode6,Bridging Header,如何将Objective-C格式转换为Swift格式?我已经创建了一个名为bridge header.h的桥接头 我已将此库标头导入桥接标头 #import "DraggableView.h" #import "DraggableViewBackground.h" #import "OverlayView.h" 然后我想把Objective-C转换成swift DraggableViewBackground *draggableBackground = [[DraggableViewBackg
bridge header.h
的桥接头
我已将此库标头导入桥接标头
#import "DraggableView.h"
#import "DraggableViewBackground.h"
#import "OverlayView.h"
然后我想把Objective-C转换成swift
DraggableViewBackground *draggableBackground = [[DraggableViewBackground alloc]initWithFrame:self.view.frame];
[self.view addSubview:draggableBackground];
到目前为止,我所做的是从我的ViewController.swift
中的DraggableViewBackground.h
调用对象DraggableViewBackground
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
var instanceOfDraggableViewBackground: DraggableViewBackground = DraggableViewBackground()
}
}
参考库:您可以试试这个。替换为您的
框架
var draggable = DraggableViewBackground(frame: CGRectMake(0, 0, 100, 100))
self.view.addSubview(draggable)