Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
3d534c3b
Commit
3d534c3b
authored
Apr 01, 2016
by
Ben Asher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Alamofire example for Xcode 7.3
parent
8e2f0ef7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
27 deletions
+43
-27
Alamofire.podspec
examples/Alamofire Example/Alamofire/Alamofire.podspec
+1
-1
Manager.swift
examples/Alamofire Example/Alamofire/Source/Manager.swift
+0
-0
MultipartFormData.swift
...lamofire Example/Alamofire/Source/MultipartFormData.swift
+0
-6
NetworkReachabilityManager.swift
...Example/Alamofire/Source/NetworkReachabilityManager.swift
+22
-10
ParameterEncoding.swift
...lamofire Example/Alamofire/Source/ParameterEncoding.swift
+1
-1
Request.swift
examples/Alamofire Example/Alamofire/Source/Request.swift
+1
-1
ResponseSerialization.swift
...fire Example/Alamofire/Source/ResponseSerialization.swift
+17
-7
DetailViewController.swift
...ples/Alamofire Example/Example/DetailViewController.swift
+1
-1
No files found.
examples/Alamofire Example/Alamofire/Alamofire.podspec
View file @
3d534c3b
Pod
::
Spec
.
new
do
|
s
|
s
.
name
=
'Alamofire'
s
.
version
=
'3.
2.1
'
s
.
version
=
'3.
3.0
'
s
.
license
=
'MIT'
s
.
summary
=
'Elegant HTTP Networking in Swift'
s
.
homepage
=
'https://github.com/Alamofire/Alamofire'
...
...
examples/Alamofire Example/Alamofire/Source/Manager.swift
View file @
3d534c3b
This diff is collapsed.
Click to expand it.
examples/Alamofire Example/Alamofire/Source/MultipartFormData.swift
View file @
3d534c3b
...
...
@@ -428,7 +428,6 @@ public class MultipartFormData {
throw
Error
.
errorWithCode
(
NSURLErrorCannotOpenFile
,
failureReason
:
failureReason
)
}
outputStream
.
scheduleInRunLoop
(
NSRunLoop
.
currentRunLoop
(),
forMode
:
NSDefaultRunLoopMode
)
outputStream
.
open
()
self
.
bodyParts
.
first
?
.
hasInitialBoundary
=
true
...
...
@@ -439,7 +438,6 @@ public class MultipartFormData {
}
outputStream
.
close
()
outputStream
.
removeFromRunLoop
(
NSRunLoop
.
currentRunLoop
(),
forMode
:
NSDefaultRunLoopMode
)
}
// MARK: - Private - Body Part Encoding
...
...
@@ -476,7 +474,6 @@ public class MultipartFormData {
private
func
encodeBodyStreamDataForBodyPart
(
bodyPart
:
BodyPart
)
throws
->
NSData
{
let
inputStream
=
bodyPart
.
bodyStream
inputStream
.
scheduleInRunLoop
(
NSRunLoop
.
currentRunLoop
(),
forMode
:
NSDefaultRunLoopMode
)
inputStream
.
open
()
var
error
:
NSError
?
...
...
@@ -503,7 +500,6 @@ public class MultipartFormData {
}
inputStream
.
close
()
inputStream
.
removeFromRunLoop
(
NSRunLoop
.
currentRunLoop
(),
forMode
:
NSDefaultRunLoopMode
)
if
let
error
=
error
{
throw
error
...
...
@@ -537,7 +533,6 @@ public class MultipartFormData {
private
func
writeBodyStreamForBodyPart
(
bodyPart
:
BodyPart
,
toOutputStream
outputStream
:
NSOutputStream
)
throws
{
let
inputStream
=
bodyPart
.
bodyStream
inputStream
.
scheduleInRunLoop
(
NSRunLoop
.
currentRunLoop
(),
forMode
:
NSDefaultRunLoopMode
)
inputStream
.
open
()
while
inputStream
.
hasBytesAvailable
{
...
...
@@ -563,7 +558,6 @@ public class MultipartFormData {
}
inputStream
.
close
()
inputStream
.
removeFromRunLoop
(
NSRunLoop
.
currentRunLoop
(),
forMode
:
NSDefaultRunLoopMode
)
}
private
func
writeFinalBoundaryDataForBodyPart
(
...
...
examples/Alamofire Example/Alamofire/Source/NetworkReachabilityManager.swift
View file @
3d534c3b
...
...
@@ -114,20 +114,32 @@ public class NetworkReachabilityManager {
}
/**
Creates a `NetworkReachabilityManager` instance with the default socket
address (`sockaddr_in6`)
.
Creates a `NetworkReachabilityManager` instance with the default socket
IPv4 or IPv6 address
.
- returns: The new `NetworkReachabilityManager` instance.
*/
public
convenience
init
?()
{
var
address
=
sockaddr_in6
()
address
.
sin6_len
=
UInt8
(
sizeofValue
(
address
))
address
.
sin6_family
=
sa_family_t
(
AF_INET6
)
guard
let
reachability
=
withUnsafePointer
(
&
address
,
{
SCNetworkReachabilityCreateWithAddress
(
nil
,
UnsafePointer
(
$0
))
})
else
{
return
nil
}
self
.
init
(
reachability
:
reachability
)
if
#available(iOS 9.0, OSX 10.10, *)
{
var
address
=
sockaddr_in6
()
address
.
sin6_len
=
UInt8
(
sizeofValue
(
address
))
address
.
sin6_family
=
sa_family_t
(
AF_INET6
)
guard
let
reachability
=
withUnsafePointer
(
&
address
,
{
SCNetworkReachabilityCreateWithAddress
(
nil
,
UnsafePointer
(
$0
))
})
else
{
return
nil
}
self
.
init
(
reachability
:
reachability
)
}
else
{
var
address
=
sockaddr_in
()
address
.
sin_len
=
UInt8
(
sizeofValue
(
address
))
address
.
sin_family
=
sa_family_t
(
AF_INET
)
guard
let
reachability
=
withUnsafePointer
(
&
address
,
{
SCNetworkReachabilityCreateWithAddress
(
nil
,
UnsafePointer
(
$0
))
})
else
{
return
nil
}
self
.
init
(
reachability
:
reachability
)
}
}
private
init
(
reachability
:
SCNetworkReachability
)
{
...
...
examples/Alamofire Example/Alamofire/Source/ParameterEncoding.swift
View file @
3d534c3b
...
...
@@ -244,7 +244,7 @@ public enum ParameterEncoding {
while
index
!=
string
.
endIndex
{
let
startIndex
=
index
let
endIndex
=
index
.
advancedBy
(
batchSize
,
limit
:
string
.
endIndex
)
let
range
=
Range
(
start
:
startIndex
,
end
:
endIndex
)
let
range
=
startIndex
..<
endIndex
let
substring
=
string
.
substringWithRange
(
range
)
...
...
examples/Alamofire Example/Alamofire/Source/Request.swift
View file @
3d534c3b
...
...
@@ -484,7 +484,7 @@ extension Request: CustomDebugStringConvertible {
let
protectionSpace
=
NSURLProtectionSpace
(
host
:
host
,
port
:
URL
.
port
?
.
integerValue
??
0
,
`
protocol
`
:
URL
.
scheme
,
protocol
:
URL
.
scheme
,
realm
:
host
,
authenticationMethod
:
NSURLAuthenticationMethodHTTPBasic
)
...
...
examples/Alamofire Example/Alamofire/Source/ResponseSerialization.swift
View file @
3d534c3b
...
...
@@ -29,10 +29,10 @@ import Foundation
*/
public
protocol
ResponseSerializerType
{
/// The type of serialized object to be created by this `ResponseSerializerType`.
typealias
SerializedObject
associatedtype
SerializedObject
/// The type of error to be created by this `ResponseSerializer` if serialization fails.
typealias
ErrorObject
:
ErrorType
associatedtype
ErrorObject
:
ErrorType
/**
A closure used by response handlers that takes a request, response, data and error and returns a result.
...
...
@@ -176,8 +176,12 @@ extension Request {
- returns: The request.
*/
public
func
responseData
(
completionHandler
:
Response
<
NSData
,
NSError
>
->
Void
)
->
Self
{
return
response
(
responseSerializer
:
Request
.
dataResponseSerializer
(),
completionHandler
:
completionHandler
)
public
func
responseData
(
queue
queue
:
dispatch_queue_t
?
=
nil
,
completionHandler
:
Response
<
NSData
,
NSError
>
->
Void
)
->
Self
{
return
response
(
queue
:
queue
,
responseSerializer
:
Request
.
dataResponseSerializer
(),
completionHandler
:
completionHandler
)
}
}
...
...
@@ -240,11 +244,13 @@ extension Request {
- returns: The request.
*/
public
func
responseString
(
encoding
encoding
:
NSStringEncoding
?
=
nil
,
queue
queue
:
dispatch_queue_t
?
=
nil
,
encoding
:
NSStringEncoding
?
=
nil
,
completionHandler
:
Response
<
String
,
NSError
>
->
Void
)
->
Self
{
return
response
(
queue
:
queue
,
responseSerializer
:
Request
.
stringResponseSerializer
(
encoding
:
encoding
),
completionHandler
:
completionHandler
)
...
...
@@ -296,11 +302,13 @@ extension Request {
- returns: The request.
*/
public
func
responseJSON
(
options
options
:
NSJSONReadingOptions
=
.
AllowFragments
,
queue
queue
:
dispatch_queue_t
?
=
nil
,
options
:
NSJSONReadingOptions
=
.
AllowFragments
,
completionHandler
:
Response
<
AnyObject
,
NSError
>
->
Void
)
->
Self
{
return
response
(
queue
:
queue
,
responseSerializer
:
Request
.
JSONResponseSerializer
(
options
:
options
),
completionHandler
:
completionHandler
)
...
...
@@ -354,11 +362,13 @@ extension Request {
- returns: The request.
*/
public
func
responsePropertyList
(
options
options
:
NSPropertyListReadOptions
=
NSPropertyListReadOptions
(),
queue
queue
:
dispatch_queue_t
?
=
nil
,
options
:
NSPropertyListReadOptions
=
NSPropertyListReadOptions
(),
completionHandler
:
Response
<
AnyObject
,
NSError
>
->
Void
)
->
Self
{
return
response
(
queue
:
queue
,
responseSerializer
:
Request
.
propertyListResponseSerializer
(
options
:
options
),
completionHandler
:
completionHandler
)
...
...
examples/Alamofire Example/Example/DetailViewController.swift
View file @
3d534c3b
...
...
@@ -46,7 +46,7 @@ class DetailViewController: UITableViewController {
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
self
.
refreshControl
?
.
addTarget
(
self
,
action
:
"refresh"
,
forControlEvents
:
.
ValueChanged
)
self
.
refreshControl
?
.
addTarget
(
self
,
action
:
#selector(
DetailViewController.refresh
)
,
forControlEvents
:
.
ValueChanged
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment