swift 3, swift2

Swift3:

dispatchQueue.main.async(execute: {

})

Swift2:
dispatch_async(dispatch_get_main_queue(),{

})

TimeInterval–swift3
NSTimeInterval–swift2

fileprivate-swift3
private-swift2

Data-swift3
NSData-swift2

URL-swift3
NSURL-swift2

UserDefaults-swift3
NSUserDefaults-swift2

URLSessionDataTask-swift3
NSURLSessionDataTask-swift2

HTTPURLResponse-swift3
NSHTTPURLResponse-swift2

JSONSerialization-swift3
NSJSONSerialization-swift2

ComparisonResult-swift3
NSComparisonResult-swift2

ViewController.present-swift3
ViewController.presentViewController-swift2

[UIApplicationLaunchOptionsKey: Any]-swift3
[NSObject : AnyObject]-swift2

UIScreen.main.bounds-swift3
UIScreen.mainScreen().bounds-swift2

override func observeValue(forKeyPath keyPath: String?,of object: Any?,change: [NSkeyvalueChangeKey : Any]?,context: UnsafeMutableRawPointer?)–swift3
override func observeValueForKeyPath(keyPath: String?,ofObject object: AnyObject?,change: [String : AnyObject]?,context: UnsafeMutablePointer)—swift2

func application(_ application: UIApplication,didRegister notificationSettings: UIUserNotificationSettings)-swift3
func application(application: UIApplication,didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings) -swift2

[AnyHashable: Any]-swift3
[NSObject : AnyObject]-swift2

func getUserInfo(withUserId userId: String!,completion: ((RCUserInfo?) -> Void)!) -swift3
func getUserInfoWithUserId(userId: String!,completion: ((RCUserInfo!) -> Void)!)-swift2

UIApplication.shared.delegate -swift3
UIApplication.sharedApplication().delegate-swift2

NSArray? .object(at: 1)-swift3
NSArray .objectAtIndex(1)-swift2

Any -swift3
AnyObject-swift2

FileManager.default.urls(for: .documentDirectory,in: .userDomainMask)[0]-swift3
NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory,inDomains: .UserDomainMask)[0]-swift2

UITableViewCellAccessoryType.none-swift3
UITableViewCellAccessoryType.None-swift2

func numberOfSections(in tableView: UITableView) -> Int –swift3
func numberOfSectionsInTableView(tableView: UITableView) -> Int —swift2

DateFormatter-swift3
NSDateFormatter-swift2

UIBarButtonItemStyle.plain –swift3
UIBarButtonItemStyle.Plain -swift2

IndexPath-swift3
NSIndexPath -swift2

tableView.dequeueReusableCell(withIdentifier: cellIdentifier)-swift3
tableView.dequeueReusableCellWithIdentifier(cellIdentifier)–swift2

tableView.numberOfRows(inSection: 0) -swift3
tableView.numberOfRowsInSection(0)-swift2

override var canBecomeFirstResponder : Bool {
return true
}-swift3
override func canBecomeFirstResponder() -> Bool {
return true
}–swift2

var hasText : Bool {
return nextTag > 1 ? true : false
}-swift3
func hasText() -> Bool {
return nextTag > 1 ? true : false
}-swift2

guard let value = element.value as? Int8,value != 0 else { return identifier }–swift3
guard let value = element.value as? Int8 where value != 0 else { return identifier }-swift2

func functionName(_ user: String)–swift3
func functionName(user: String)–swift2

tableView.register( –swift3 tableView.registerClass( –swift2

相关文章

软件简介:蓝湖辅助工具,减少移动端开发中控件属性的复制和粘...
现实生活中,我们听到的声音都是时间连续的,我们称为这种信...
前言最近在B站上看到一个漂亮的仙女姐姐跳舞视频,循环看了亿...
【Android App】实战项目之仿抖音的短视频分享App(附源码和...
前言这一篇博客应该是我花时间最多的一次了,从2022年1月底至...
因为我既对接过session、cookie,也对接过JWT,今年因为工作...