{"action":"created","comment":{"url":"https://api.github.com/repos/brightify/SwiftKit/pulls/comments/33560981","id":33560981,"diff_hunk":"@@ -0,0 +1,202 @@\n+//\n+//  Map.swift\n+//  Pods\n+//\n+//  Created by Tadeáš Kříž on 6/26/15.\n+//\n+//\n+\n+import Foundation\n+import SwiftyJSON\n+\n+// Needed because of: http://stackoverflow.com/questions/31127786/compilation-fails-with-valid-code-when-fastest-o-optimizations-are-set/31127787#31127787\n+public class JSONBox {\n+    \n+    private let read: () -> JSON\n+    private let write: JSON -> ()\n+    \n+    public init(var json: JSON) {\n+        read = {\n+            return json\n+        }\n+        write = {\n+            json = $0\n+        }\n+    }\n+    \n+    public init(inout json: JSON) {\n+        read = {\n+            return json\n+        }\n+        write = {\n+            json = $0\n+        }\n+    }\n+    \n+    public init(read: () -> JSON, write: JSON -> ()) {\n+        self.read = read\n+        self.write = write\n+    }\n+    \n+    public var unbox: JSON {\n+        get {\n+            return read()\n+        }\n+        set {\n+            write(newValue)\n+        }\n+    }\n+}\n+\n+public enum MappingDirection {\n+    case FromJSON\n+    case ToJSON\n+}\n+\n+public protocol Map: class {\n+    var objectMapper: ObjectMapper { get }\n+    var direction: MappingDirection { get }\n+    var json: JSONBox { get }\n+    \n+    subscript(path: [SubscriptType]) -> Map { get }\n+    subscript(path: SubscriptType...) -> Map { get }\n+    \n+    func value<T>() -> T?\n+    \n+    func object<T: Mappable>() -> T?\n+    \n+    func objectArray<T: Mappable>() -> [T]?\n+    \n+    func setValue<T: AnyObject>(value: T?)\n+    \n+    func setObject<T: Mappable>(object: T?)\n+    \n+    func setObjectArray<T: Mappable>(objectArray: [T]?)\n+    \n+    func assignValueTo<T>(inout field: T)\n+    \n+    func assignValueTo<T>(inout field: T!)\n+    \n+    func assignValueTo<T>(inout field: T?)\n+    \n+    func assignObjectTo<T: Mappable>(inout field: T)\n+    \n+    func assignObjectTo<T: Mappable>(inout field: T!)\n+    \n+    func assignObjectTo<T: Mappable>(inout field: T?)\n+    \n+    func assignObjectArrayTo<T: Mappable>(inout field: [T])\n+}\n+\n+public class BaseMap: Map {\n+    public let objectMapper: ObjectMapper\n+    public let direction: MappingDirection\n+    public let json: JSONBox\n+    \n+    public convenience init(objectMapper: ObjectMapper, mappingDirection: MappingDirection, json: JSON = [:]) {\n+        self.init(objectMapper: objectMapper, mappingDirection: mappingDirection, jsonBox: JSONBox(json: json))\n+    }\n+    \n+    public init(objectMapper: ObjectMapper, mappingDirection: MappingDirection, jsonBox: JSONBox) {\n+        self.objectMapper = objectMapper\n+        self.direction = mappingDirection\n+        self.json = jsonBox\n+    }\n+    \n+    public subscript(path: [SubscriptType]) -> Map {\n+        return ChildMap(parentMap: self, path: path)\n+    }\n+    \n+    public subscript(path: SubscriptType...) -> Map {","path":"ObjectMapper/Map.swift","position":110,"original_position":110,"commit_id":"78a60ee8fdb23104e367634f64b0d0e15810f065","original_commit_id":"78a60ee8fdb23104e367634f64b0d0e15810f065","user":{"login":"TadeasKriz","id":284197,"avatar_url":"https://avatars.githubusercontent.com/u/284197?v=3","gravatar_id":"","url":"https://api.github.com/users/TadeasKriz","html_url":"https://github.com/TadeasKriz","followers_url":"https://api.github.com/users/TadeasKriz/followers","following_url":"https://api.github.com/users/TadeasKriz/following{/other_user}","gists_url":"https://api.github.com/users/TadeasKriz/gists{/gist_id}","starred_url":"https://api.github.com/users/TadeasKriz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TadeasKriz/subscriptions","organizations_url":"https://api.github.com/users/TadeasKriz/orgs","repos_url":"https://api.github.com/users/TadeasKriz/repos","events_url":"https://api.github.com/users/TadeasKriz/events{/privacy}","received_events_url":"https://api.github.com/users/TadeasKriz/received_events","type":"User","site_admin":false},"body":"We can try.","created_at":"2015-06-30T10:53:56Z","updated_at":"2015-06-30T10:53:56Z","html_url":"https://github.com/brightify/SwiftKit/pull/15#discussion_r33560981","pull_request_url":"https://api.github.com/repos/brightify/SwiftKit/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/brightify/SwiftKit/pulls/comments/33560981"},"html":{"href":"https://github.com/brightify/SwiftKit/pull/15#discussion_r33560981"},"pull_request":{"href":"https://api.github.com/repos/brightify/SwiftKit/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/brightify/SwiftKit/pulls/15","id":38835303,"html_url":"https://github.com/brightify/SwiftKit/pull/15","diff_url":"https://github.com/brightify/SwiftKit/pull/15.diff","patch_url":"https://github.com/brightify/SwiftKit/pull/15.patch","issue_url":"https://api.github.com/repos/brightify/SwiftKit/issues/15","number":15,"state":"open","locked":false,"title":"Feature/objectmapper","user":{"login":"TadeasKriz","id":284197,"avatar_url":"https://avatars.githubusercontent.com/u/284197?v=3","gravatar_id":"","url":"https://api.github.com/users/TadeasKriz","html_url":"https://github.com/TadeasKriz","followers_url":"https://api.github.com/users/TadeasKriz/followers","following_url":"https://api.github.com/users/TadeasKriz/following{/other_user}","gists_url":"https://api.github.com/users/TadeasKriz/gists{/gist_id}","starred_url":"https://api.github.com/users/TadeasKriz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TadeasKriz/subscriptions","organizations_url":"https://api.github.com/users/TadeasKriz/orgs","repos_url":"https://api.github.com/users/TadeasKriz/repos","events_url":"https://api.github.com/users/TadeasKriz/events{/privacy}","received_events_url":"https://api.github.com/users/TadeasKriz/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-30T01:40:36Z","updated_at":"2015-06-30T10:53:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/brightify/SwiftKit/pulls/15/commits","review_comments_url":"https://api.github.com/repos/brightify/SwiftKit/pulls/15/comments","review_comment_url":"https://api.github.com/repos/brightify/SwiftKit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/brightify/SwiftKit/issues/15/comments","statuses_url":"https://api.github.com/repos/brightify/SwiftKit/statuses/78a60ee8fdb23104e367634f64b0d0e15810f065","head":{"label":"brightify:feature/objectmapper","ref":"feature/objectmapper","sha":"78a60ee8fdb23104e367634f64b0d0e15810f065","user":{"login":"brightify","id":6544014,"avatar_url":"https://avatars.githubusercontent.com/u/6544014?v=3","gravatar_id":"","url":"https://api.github.com/users/brightify","html_url":"https://github.com/brightify","followers_url":"https://api.github.com/users/brightify/followers","following_url":"https://api.github.com/users/brightify/following{/other_user}","gists_url":"https://api.github.com/users/brightify/gists{/gist_id}","starred_url":"https://api.github.com/users/brightify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brightify/subscriptions","organizations_url":"https://api.github.com/users/brightify/orgs","repos_url":"https://api.github.com/users/brightify/repos","events_url":"https://api.github.com/users/brightify/events{/privacy}","received_events_url":"https://api.github.com/users/brightify/received_events","type":"Organization","site_admin":false},"repo":{"id":35777305,"name":"SwiftKit","full_name":"brightify/SwiftKit","owner":{"login":"brightify","id":6544014,"avatar_url":"https://avatars.githubusercontent.com/u/6544014?v=3","gravatar_id":"","url":"https://api.github.com/users/brightify","html_url":"https://github.com/brightify","followers_url":"https://api.github.com/users/brightify/followers","following_url":"https://api.github.com/users/brightify/following{/other_user}","gists_url":"https://api.github.com/users/brightify/gists{/gist_id}","starred_url":"https://api.github.com/users/brightify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brightify/subscriptions","organizations_url":"https://api.github.com/users/brightify/orgs","repos_url":"https://api.github.com/users/brightify/repos","events_url":"https://api.github.com/users/brightify/events{/privacy}","received_events_url":"https://api.github.com/users/brightify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/brightify/SwiftKit","description":"","fork":false,"url":"https://api.github.com/repos/brightify/SwiftKit","forks_url":"https://api.github.com/repos/brightify/SwiftKit/forks","keys_url":"https://api.github.com/repos/brightify/SwiftKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brightify/SwiftKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brightify/SwiftKit/teams","hooks_url":"https://api.github.com/repos/brightify/SwiftKit/hooks","issue_events_url":"https://api.github.com/repos/brightify/SwiftKit/issues/events{/number}","events_url":"https://api.github.com/repos/brightify/SwiftKit/events","assignees_url":"https://api.github.com/repos/brightify/SwiftKit/assignees{/user}","branches_url":"https://api.github.com/repos/brightify/SwiftKit/branches{/branch}","tags_url":"https://api.github.com/repos/brightify/SwiftKit/tags","blobs_url":"https://api.github.com/repos/brightify/SwiftKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brightify/SwiftKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brightify/SwiftKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/brightify/SwiftKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brightify/SwiftKit/statuses/{sha}","languages_url":"https://api.github.com/repos/brightify/SwiftKit/languages","stargazers_url":"https://api.github.com/repos/brightify/SwiftKit/stargazers","contributors_url":"https://api.github.com/repos/brightify/SwiftKit/contributors","subscribers_url":"https://api.github.com/repos/brightify/SwiftKit/subscribers","subscription_url":"https://api.github.com/repos/brightify/SwiftKit/subscription","commits_url":"https://api.github.com/repos/brightify/SwiftKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/brightify/SwiftKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/brightify/SwiftKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/brightify/SwiftKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/brightify/SwiftKit/contents/{+path}","compare_url":"https://api.github.com/repos/brightify/SwiftKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brightify/SwiftKit/merges","archive_url":"https://api.github.com/repos/brightify/SwiftKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brightify/SwiftKit/downloads","issues_url":"https://api.github.com/repos/brightify/SwiftKit/issues{/number}","pulls_url":"https://api.github.com/repos/brightify/SwiftKit/pulls{/number}","milestones_url":"https://api.github.com/repos/brightify/SwiftKit/milestones{/number}","notifications_url":"https://api.github.com/repos/brightify/SwiftKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brightify/SwiftKit/labels{/name}","releases_url":"https://api.github.com/repos/brightify/SwiftKit/releases{/id}","created_at":"2015-05-17T18:22:37Z","updated_at":"2015-05-22T16:52:22Z","pushed_at":"2015-06-30T01:40:36Z","git_url":"git://github.com/brightify/SwiftKit.git","ssh_url":"git@github.com:brightify/SwiftKit.git","clone_url":"https://github.com/brightify/SwiftKit.git","svn_url":"https://github.com/brightify/SwiftKit","homepage":null,"size":630,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":8,"forks":1,"open_issues":8,"watchers":0,"default_branch":"master"}},"base":{"label":"brightify:master","ref":"master","sha":"c008710387f718ed0d6e44246e4ba0c93f65ed67","user":{"login":"brightify","id":6544014,"avatar_url":"https://avatars.githubusercontent.com/u/6544014?v=3","gravatar_id":"","url":"https://api.github.com/users/brightify","html_url":"https://github.com/brightify","followers_url":"https://api.github.com/users/brightify/followers","following_url":"https://api.github.com/users/brightify/following{/other_user}","gists_url":"https://api.github.com/users/brightify/gists{/gist_id}","starred_url":"https://api.github.com/users/brightify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brightify/subscriptions","organizations_url":"https://api.github.com/users/brightify/orgs","repos_url":"https://api.github.com/users/brightify/repos","events_url":"https://api.github.com/users/brightify/events{/privacy}","received_events_url":"https://api.github.com/users/brightify/received_events","type":"Organization","site_admin":false},"repo":{"id":35777305,"name":"SwiftKit","full_name":"brightify/SwiftKit","owner":{"login":"brightify","id":6544014,"avatar_url":"https://avatars.githubusercontent.com/u/6544014?v=3","gravatar_id":"","url":"https://api.github.com/users/brightify","html_url":"https://github.com/brightify","followers_url":"https://api.github.com/users/brightify/followers","following_url":"https://api.github.com/users/brightify/following{/other_user}","gists_url":"https://api.github.com/users/brightify/gists{/gist_id}","starred_url":"https://api.github.com/users/brightify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brightify/subscriptions","organizations_url":"https://api.github.com/users/brightify/orgs","repos_url":"https://api.github.com/users/brightify/repos","events_url":"https://api.github.com/users/brightify/events{/privacy}","received_events_url":"https://api.github.com/users/brightify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/brightify/SwiftKit","description":"","fork":false,"url":"https://api.github.com/repos/brightify/SwiftKit","forks_url":"https://api.github.com/repos/brightify/SwiftKit/forks","keys_url":"https://api.github.com/repos/brightify/SwiftKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brightify/SwiftKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brightify/SwiftKit/teams","hooks_url":"https://api.github.com/repos/brightify/SwiftKit/hooks","issue_events_url":"https://api.github.com/repos/brightify/SwiftKit/issues/events{/number}","events_url":"https://api.github.com/repos/brightify/SwiftKit/events","assignees_url":"https://api.github.com/repos/brightify/SwiftKit/assignees{/user}","branches_url":"https://api.github.com/repos/brightify/SwiftKit/branches{/branch}","tags_url":"https://api.github.com/repos/brightify/SwiftKit/tags","blobs_url":"https://api.github.com/repos/brightify/SwiftKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brightify/SwiftKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brightify/SwiftKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/brightify/SwiftKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brightify/SwiftKit/statuses/{sha}","languages_url":"https://api.github.com/repos/brightify/SwiftKit/languages","stargazers_url":"https://api.github.com/repos/brightify/SwiftKit/stargazers","contributors_url":"https://api.github.com/repos/brightify/SwiftKit/contributors","subscribers_url":"https://api.github.com/repos/brightify/SwiftKit/subscribers","subscription_url":"https://api.github.com/repos/brightify/SwiftKit/subscription","commits_url":"https://api.github.com/repos/brightify/SwiftKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/brightify/SwiftKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/brightify/SwiftKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/brightify/SwiftKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/brightify/SwiftKit/contents/{+path}","compare_url":"https://api.github.com/repos/brightify/SwiftKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brightify/SwiftKit/merges","archive_url":"https://api.github.com/repos/brightify/SwiftKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brightify/SwiftKit/downloads","issues_url":"https://api.github.com/repos/brightify/SwiftKit/issues{/number}","pulls_url":"https://api.github.com/repos/brightify/SwiftKit/pulls{/number}","milestones_url":"https://api.github.com/repos/brightify/SwiftKit/milestones{/number}","notifications_url":"https://api.github.com/repos/brightify/SwiftKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brightify/SwiftKit/labels{/name}","releases_url":"https://api.github.com/repos/brightify/SwiftKit/releases{/id}","created_at":"2015-05-17T18:22:37Z","updated_at":"2015-05-22T16:52:22Z","pushed_at":"2015-06-30T01:40:36Z","git_url":"git://github.com/brightify/SwiftKit.git","ssh_url":"git@github.com:brightify/SwiftKit.git","clone_url":"https://github.com/brightify/SwiftKit.git","svn_url":"https://github.com/brightify/SwiftKit","homepage":null,"size":630,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":8,"forks":1,"open_issues":8,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/brightify/SwiftKit/pulls/15"},"html":{"href":"https://github.com/brightify/SwiftKit/pull/15"},"issue":{"href":"https://api.github.com/repos/brightify/SwiftKit/issues/15"},"comments":{"href":"https://api.github.com/repos/brightify/SwiftKit/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/brightify/SwiftKit/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/brightify/SwiftKit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/brightify/SwiftKit/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/brightify/SwiftKit/statuses/78a60ee8fdb23104e367634f64b0d0e15810f065"}}}}