Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
white49
Alamofire
提交
1e3c5470
A
Alamofire
项目概览
white49
/
Alamofire
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
Alamofire
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1e3c5470
编写于
8月 06, 2016
作者:
C
Christian Noon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated MARKs in SessionManager to make jumpbar more readable.
上级
8bb74734
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
26 deletion
+17
-26
Source/SessionManager.swift
Source/SessionManager.swift
+17
-26
未找到文件。
Source/SessionManager.swift
浏览文件 @
1e3c5470
...
...
@@ -29,7 +29,7 @@ import Foundation
*/
public
class
SessionManager
{
// MARK:
-
Properties
// MARK: Properties
/**
A shared instance of `SessionManager`, used by top-level Alamofire request methods, and suitable for use
...
...
@@ -122,7 +122,7 @@ public class SessionManager {
*/
public
var
backgroundCompletionHandler
:
(()
->
Void
)?
// MARK:
-
Lifecycle
// MARK: Lifecycle
/**
Initializes the `Manager` instance with the specified configuration, delegate and server trust policy.
...
...
@@ -183,7 +183,7 @@ public class SessionManager {
session
.
invalidateAndCancel
()
}
// MARK:
-
Request
// MARK: Request
/**
Creates a request for the specified method, URL string, parameters, parameter encoding and headers.
...
...
@@ -232,13 +232,18 @@ public class SessionManager {
return
request
}
}
// MARK: - SessionDelegate
// MARK: -
extension
SessionManager
{
/**
Responsible for handling all delegate callbacks for the underlying session.
*/
public
class
SessionDelegate
:
NSObject
,
URLSessionDelegate
,
URLSessionTaskDelegate
,
URLSessionDataDelegate
,
URLSessionDownloadDelegate
{
// MARK: Properties
private
var
subdelegates
:
[
Int
:
Request
.
TaskDelegate
]
=
[:]
private
let
subdelegateQueue
=
DispatchQueue
(
label
:
"Alamofire Sub Delegate Queue"
,
attributes
:
.
concurrent
)
...
...
@@ -255,6 +260,8 @@ public class SessionManager {
}
}
// MARK: Lifecycle
/**
Initializes the `SessionDelegate` instance.
...
...
@@ -264,9 +271,7 @@ public class SessionManager {
super
.
init
()
}
// MARK: - NSURLSessionDelegate
// MARK: Override Closures
// MARK: NSURLSessionDelegate
/// Overrides default behavior for NSURLSessionDelegate method `URLSession:didBecomeInvalidWithError:`.
public
var
sessionDidBecomeInvalidWithError
:
((
Foundation
.
URLSession
,
NSError
?)
->
Void
)?
...
...
@@ -280,8 +285,6 @@ public class SessionManager {
/// Overrides default behavior for NSURLSessionDelegate method `URLSessionDidFinishEventsForBackgroundURLSession:`.
public
var
sessionDidFinishEventsForBackgroundURLSession
:
((
Foundation
.
URLSession
)
->
Void
)?
// MARK: Delegate Methods
/**
Tells the delegate that the session has been invalidated.
...
...
@@ -343,9 +346,7 @@ public class SessionManager {
}
#endif
// MARK: - NSURLSessionTaskDelegate
// MARK: Override Closures
// MARK: NSURLSessionTaskDelegate
/// Overrides default behavior for NSURLSessionTaskDelegate method `URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:`.
public
var
taskWillPerformHTTPRedirection
:
((
Foundation
.
URLSession
,
URLSessionTask
,
HTTPURLResponse
,
Foundation
.
URLRequest
)
->
Foundation
.
URLRequest
?)?
...
...
@@ -374,8 +375,6 @@ public class SessionManager {
/// Overrides default behavior for NSURLSessionTaskDelegate method `URLSession:task:didCompleteWithError:`.
public
var
taskDidComplete
:
((
Foundation
.
URLSession
,
URLSessionTask
,
NSError
?)
->
Void
)?
// MARK: Delegate Methods
/**
Tells the delegate that the remote server requested an HTTP redirect.
...
...
@@ -518,9 +517,7 @@ public class SessionManager {
self
[
task
]
=
nil
}
// MARK: - NSURLSessionDataDelegate
// MARK: Override Closures
// MARK: NSURLSessionDataDelegate
/// Overrides default behavior for NSURLSessionDataDelegate method `URLSession:dataTask:didReceiveResponse:completionHandler:`.
public
var
dataTaskDidReceiveResponse
:
((
Foundation
.
URLSession
,
URLSessionDataTask
,
URLResponse
)
->
Foundation
.
URLSession
.
ResponseDisposition
)?
...
...
@@ -542,8 +539,6 @@ public class SessionManager {
/// requires caller to call the `completionHandler`.
public
var
dataTaskWillCacheResponseWithCompletion
:
((
Foundation
.
URLSession
,
URLSessionDataTask
,
CachedURLResponse
,
(
CachedURLResponse
?)
->
Void
)
->
Void
)?
// MARK: Delegate Methods
/**
Tells the delegate that the data task received the initial reply (headers) from the server.
...
...
@@ -647,9 +642,7 @@ public class SessionManager {
}
}
// MARK: - NSURLSessionDownloadDelegate
// MARK: Override Closures
// MARK: NSURLSessionDownloadDelegate
/// Overrides default behavior for NSURLSessionDownloadDelegate method `URLSession:downloadTask:didFinishDownloadingToURL:`.
public
var
downloadTaskDidFinishDownloadingToURL
:
((
Foundation
.
URLSession
,
URLSessionDownloadTask
,
URL
)
->
Void
)?
...
...
@@ -660,8 +653,6 @@ public class SessionManager {
/// Overrides default behavior for NSURLSessionDownloadDelegate method `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`.
public
var
downloadTaskDidResumeAtOffset
:
((
Foundation
.
URLSession
,
URLSessionDownloadTask
,
Int64
,
Int64
)
->
Void
)?
// MARK: Delegate Methods
/**
Tells the delegate that a download task has finished downloading.
...
...
@@ -745,14 +736,14 @@ public class SessionManager {
}
}
// MARK:
-
NSURLSessionStreamDelegate
// MARK: NSURLSessionStreamDelegate
var
_streamTaskReadClosed
:
Any
?
var
_streamTaskWriteClosed
:
Any
?
var
_streamTaskBetterRouteDiscovered
:
Any
?
var
_streamTaskDidBecomeInputStream
:
Any
?
// MARK:
-
NSObject
// MARK: NSObject
public
override
func
responds
(
to
selector
:
Selector
)
->
Bool
{
#if !os(OSX)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录