swift 3, swift2

前端之家收集整理的这篇文章主要介绍了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

原文链接:https://www.f2er.com/swift/322380.html

猜你在找的Swift相关文章