Skip to content

Commit

Permalink
Fix some minor typecasting things
Browse files Browse the repository at this point in the history
  • Loading branch information
neonichu committed Dec 7, 2015
1 parent ad80982 commit 79dc787
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public struct Configuration {

public var userAgent : String {
var osName = "iOS"
let osVersion: AnyObject = NSProcessInfo.processInfo().operatingSystemVersionString ?? "Unknown"
let osVersion = NSProcessInfo.processInfo().operatingSystemVersionString ?? "Unknown"

#if os(OSX)
osName = "OS X"
Expand Down
6 changes: 5 additions & 1 deletion Sources/ContentfulClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ public class ContentfulClient {
private func URLForFragment(fragment: String = "", parameters: [String: AnyObject]? = nil) -> NSURL? {
if let components = NSURLComponents(string: "\(scheme)://\(configuration.server)/spaces/\(spaceIdentifier)/\(fragment)") {
if let parameters = parameters {
components.queryItems = parameters.map() { (key, value) in NSURLQueryItem(name: key, value: value.description) }
let parameters = parameters.filter { ($0 as? CustomStringConvertible) == nil }
components.queryItems = parameters.map() { (key, value) in
let value = value as! CustomStringConvertible
return NSURLQueryItem(name: key, value: value.description)
}
}

if let url = components.URL {
Expand Down
7 changes: 6 additions & 1 deletion Sources/Decoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,12 @@ private extension Resource {

if let resources = jsonIncludes[typename] as? [[String:AnyObject]] {
for resource in resources {
let value = try self.decode(resource) as Resource
#if os(Linux)
let castedResource = resource as! AnyObject
#else
let castedResource = resource as AnyObject
#endif
let value = try self.decode(castedResource) as Resource
includes[value.key] = value
}
}
Expand Down

0 comments on commit 79dc787

Please sign in to comment.