Skip to content

Commit

Permalink
Fix warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
ocollet committed Dec 3, 2018
1 parent 75e2fc4 commit b5dc4f5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Snowplow/Payload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ extension Payload: Codable {

public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let contentData = try container.decode(Data.self, forKey: .content)
guard let decodedContent = try JSONSerialization.jsonObject(with: contentData, options: []) as? [String: Any] else {
let data = try container.decode(Data.self, forKey: .content)
guard let decodedContent = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else {
throw DecodingError.dataCorruptedError(forKey: CodingKeys.content, in: container, debugDescription: "")
}
content = decodedContent
Expand Down
4 changes: 2 additions & 2 deletions Snowplow/PropertyKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public enum PropertyKey: String {
case referrer = "refr"

// Screen view event
case name = "name"
case id = "id"
case name = "name"
case identifier = "id"

// Structured event
case category = "se_ca"
Expand Down
4 changes: 3 additions & 1 deletion Snowplow/SelfDescribingJSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ public struct SelfDescribingJSON {
extension SelfDescribingJSON {

public var base64EncodedRepresentation: String? {
guard let data = try? JSONSerialization.data(withJSONObject: dictionaryRepresentation, options: []) else { return nil }
guard let data = try? JSONSerialization.data(withJSONObject: dictionaryRepresentation, options: []) else {
return nil
}
return data.base64EncodedString()
}

Expand Down
2 changes: 1 addition & 1 deletion Snowplow/Tracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ extension Tracker {
identifier: String? = nil) {
var data: [PropertyKey: Any] = [.name: name]
if let identifier = identifier {
data[.id] = identifier
data[.identifier] = identifier
}
let json = SelfDescribingJSON(schema: .screenView, data: data)
let payload = Payload(json, isBase64Encoded: isBase64Encoded)
Expand Down

0 comments on commit b5dc4f5

Please sign in to comment.