微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐