Skip to content

Commit

Permalink
resolve warnings from 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nghialv committed May 24, 2015
1 parent 3f6a70b commit 9f7b064
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
11 changes: 5 additions & 6 deletions Net/Net.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ class Net : NSObject, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate, NS
}

// MARK: NSURLSessionDelegate
func URLSessionDidFinishEventsForBackgroundURLSession(session: NSURLSession!) {
func URLSessionDidFinishEventsForBackgroundURLSession(session: NSURLSession) {
// this will be call for every backgroud event
eventsForBackgroundHandler?(session)
}

// MARK: NSURLSessionTaskDelegate
func URLSession(session: NSURLSession!, task: NSURLSessionTask!, didCompleteWithError error: NSError!) {
func URLSession(session: NSURLSession, task: NSURLSessionTask, didCompleteWithError error: NSError?) {
if (error != nil) {
if let downloadTask = task as? NSURLSessionDownloadTask {
let downloader = downloaders[downloadTask]
Expand All @@ -236,7 +236,7 @@ class Net : NSObject, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate, NS
}
}

func URLSession(session: NSURLSession!, task: NSURLSessionTask!, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) {
func URLSession(session: NSURLSession, task: NSURLSessionTask, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) {
// upload progress
if let uploadTask = task as? NSURLSessionUploadTask {
let progress = Double(totalBytesSent) / Double(totalBytesExpectedToSend)
Expand All @@ -246,13 +246,12 @@ class Net : NSObject, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate, NS
}
}

func URLSession(session: NSURLSession!, task: NSURLSessionTask!, willPerformHTTPRedirection response: NSHTTPURLResponse!, newRequest request: NSURLRequest!, completionHandler: ((NSURLRequest!) -> Void)!) {

func URLSession(session: NSURLSession, task: NSURLSessionTask, willPerformHTTPRedirection response: NSHTTPURLResponse, newRequest request: NSURLRequest, completionHandler: (NSURLRequest!) -> Void) {
}


// MARK: NSURLSessionDownloadDelegate
func URLSession(session: NSURLSession!, downloadTask: NSURLSessionDownloadTask!, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) {
func URLSession(session: NSURLSession, downloadTask: NSURLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) {
let progress = totalBytesExpectedToWrite == NSURLSessionTransferSizeUnknown ? -1.0 : Double(totalBytesWritten) / Double(totalBytesExpectedToWrite)

let downloader = downloaders[downloadTask]
Expand Down
12 changes: 1 addition & 11 deletions ios_example/example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
NSLog("handle event for background session")
}

func applicationDidEnterBackground(application: UIApplication!) {
func applicationDidEnterBackground(application: UIApplication) {
NSLog("App did enter background")
}

func applicationWillEnterForeground(application: UIApplication!) {
}

func applicationDidBecomeActive(application: UIApplication!) {
}

func applicationWillTerminate(application: UIApplication!) {
}

}

4 changes: 2 additions & 2 deletions ios_example/example/HttpViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class HttpViewController: UIViewController, NSXMLParserDelegate {
}

// MARK: NSXMLParser delegate
func parser(parser: NSXMLParser!, didStartElement elementName: String!, namespaceURI: String!, qualifiedName qName: String!, attributes attributeDict: [NSObject : AnyObject]!) {
func parser(parser: NSXMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [NSObject : AnyObject]) {
NSLog("did start element : \(elementName)")
}

func parser(parser: NSXMLParser!, foundCharacters string: String!) {
func parser(parser: NSXMLParser, foundCharacters string: String?) {
}

// MARK: Actions
Expand Down

0 comments on commit 9f7b064

Please sign in to comment.