{"action":"created","comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/comments/71726560","id":71726560,"diff_hunk":"@@ -0,0 +1,82 @@\n+'use strict';\n+\n+const fs = require('fs');\n+const ejs = require('ejs');\n+const spec = require('mapbox-gl-style-spec').latest;\n+\n+global.camelize = function (str) {\n+    return str.replace(/(?:^|-)(.)/g, function (_, x) {\n+        return x.toUpperCase();\n+    });\n+}\n+\n+global.camelizeWithLeadingLowercase = function (str) {\n+    return str.replace(/-(.)/g, function (_, x) {\n+        return x.toUpperCase();\n+    });\n+}\n+\n+global.isObject = function (property) {\n+    switch (property.type) {\n+        case 'string':\n+            return true;\n+        case 'color':\n+            return true;\n+        case 'array':\n+            return true;\n+        case 'enum': // (enum will be converted to NSString hence isObject(enum) == true)\n+            return true;\n+        default:\n+            return false;\n+    }\n+}\n+\n+global.propertyType = function (property) {\n+    switch (property.type) {\n+        case 'boolean':\n+            return 'BOOL';\n+        case 'number':\n+            return 'float';\n+        case 'string':\n+            return 'NSString';\n+        case 'enum':\n+            return 'NSString';\n+        case 'color':\n+            return `MGLColor`;\n+        case 'array':\n+            if (property.length) {\n+                return `NSMutableArray`;\n+            } else {\n+                return `CGVector`;","path":"platform/ios/scripts/generate-style-code.js","position":50,"original_position":50,"commit_id":"2ab2ab222fc4b4aa5eaaeaba7c57f0c535accb34","original_commit_id":"2ab2ab222fc4b4aa5eaaeaba7c57f0c535accb34","user":{"login":"1ec5","id":1231218,"avatar_url":"https://avatars.githubusercontent.com/u/1231218?v=3","gravatar_id":"","url":"https://api.github.com/users/1ec5","html_url":"https://github.com/1ec5","followers_url":"https://api.github.com/users/1ec5/followers","following_url":"https://api.github.com/users/1ec5/following{/other_user}","gists_url":"https://api.github.com/users/1ec5/gists{/gist_id}","starred_url":"https://api.github.com/users/1ec5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1ec5/subscriptions","organizations_url":"https://api.github.com/users/1ec5/orgs","repos_url":"https://api.github.com/users/1ec5/repos","events_url":"https://api.github.com/users/1ec5/events{/privacy}","received_events_url":"https://api.github.com/users/1ec5/received_events","type":"User","site_admin":false},"body":"In that case, I think we should use `CGVector` for specific properties, based on the property name. The style specification uses its `Array` type for a variety of things that Cocoa conventionally represents with different types. For example:\r\n\r\n* [`center`](https://www.mapbox.com/mapbox-gl-style-spec/#root-center) as `CLLocationCoordinate2D`\r\n* [`fill-translate`](https://www.mapbox.com/mapbox-gl-style-spec/#paint-fill-translate), [`line-translate`](https://www.mapbox.com/mapbox-gl-style-spec/#paint-line-translate), [`icon-offset`](https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-icon-offset), [`text-offset`](https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-offset), [`icon-translate`](https://www.mapbox.com/mapbox-gl-style-spec/#paint-icon-translate), [`text-translate`](https://www.mapbox.com/mapbox-gl-style-spec/#paint-text-translate), [`circle-translate`](https://www.mapbox.com/mapbox-gl-style-spec/#paint-circle-translate) as `CGVector`\r\n  * `text-offset` is a good example of why `CGVector` is preferable to `NSPoint`/`CGPoint`: its unit is ems rather than screen points\r\n* [`line-dasharray`](https://www.mapbox.com/mapbox-gl-style-spec/#paint-line-dasharray) as `NSArray<NSNumber *> *` or `CGFloat *`\r\n  * I’m wary of introducing C arrays into this API. If we use NSNumber, maybe we should use NSNumber for [all the other `Number`-typed properties](https://github.com/mapbox/mapbox-gl-native/pull/5727/files/2ab2ab222fc4b4aa5eaaeaba7c57f0c535accb34#r71622482) too.\r\n* [`icon-text-fit-padding`](https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-icon-text-fit-padding) as `NSEdgeInsets`/`UIEdgeInsets`\r\n* [`text-font`](https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-icon-offset) as `NSArray<NSString *> *` (or `NSArray<NSFontDescriptor *> *` / `NSArray<UIFontDescriptor *> *`?)","created_at":"2016-07-21T15:21:00Z","updated_at":"2016-07-21T15:21:00Z","html_url":"https://github.com/mapbox/mapbox-gl-native/pull/5727#discussion_r71726560","pull_request_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/5727","_links":{"self":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/comments/71726560"},"html":{"href":"https://github.com/mapbox/mapbox-gl-native/pull/5727#discussion_r71726560"},"pull_request":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/5727"}}},"pull_request":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/5727","id":78030174,"html_url":"https://github.com/mapbox/mapbox-gl-native/pull/5727","diff_url":"https://github.com/mapbox/mapbox-gl-native/pull/5727.diff","patch_url":"https://github.com/mapbox/mapbox-gl-native/pull/5727.patch","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/5727","number":5727,"state":"open","locked":false,"title":"[ios, macos] #5626 wip runtime styling","user":{"login":"frederoni","id":764476,"avatar_url":"https://avatars.githubusercontent.com/u/764476?v=3","gravatar_id":"","url":"https://api.github.com/users/frederoni","html_url":"https://github.com/frederoni","followers_url":"https://api.github.com/users/frederoni/followers","following_url":"https://api.github.com/users/frederoni/following{/other_user}","gists_url":"https://api.github.com/users/frederoni/gists{/gist_id}","starred_url":"https://api.github.com/users/frederoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frederoni/subscriptions","organizations_url":"https://api.github.com/users/frederoni/orgs","repos_url":"https://api.github.com/users/frederoni/repos","events_url":"https://api.github.com/users/frederoni/events{/privacy}","received_events_url":"https://api.github.com/users/frederoni/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-19T18:58:08Z","updated_at":"2016-07-21T15:21:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5972922de84f5ddbcc277a93c71e721862fa3dbc","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/milestones/37","html_url":"https://github.com/mapbox/mapbox-gl-native/milestones/ios-v3.4.0","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/milestones/37/labels","id":1783804,"number":37,"title":"ios-v3.4.0","description":"","creator":{"login":"friedbunny","id":1198851,"avatar_url":"https://avatars.githubusercontent.com/u/1198851?v=3","gravatar_id":"","url":"https://api.github.com/users/friedbunny","html_url":"https://github.com/friedbunny","followers_url":"https://api.github.com/users/friedbunny/followers","following_url":"https://api.github.com/users/friedbunny/following{/other_user}","gists_url":"https://api.github.com/users/friedbunny/gists{/gist_id}","starred_url":"https://api.github.com/users/friedbunny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/friedbunny/subscriptions","organizations_url":"https://api.github.com/users/friedbunny/orgs","repos_url":"https://api.github.com/users/friedbunny/repos","events_url":"https://api.github.com/users/friedbunny/events{/privacy}","received_events_url":"https://api.github.com/users/friedbunny/received_events","type":"User","site_admin":false},"open_issues":21,"closed_issues":0,"state":"open","created_at":"2016-05-23T22:50:20Z","updated_at":"2016-07-20T17:49:32Z","due_on":"2016-08-04T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/5727/commits","review_comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/5727/comments","review_comment_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/5727/comments","statuses_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/statuses/2ab2ab222fc4b4aa5eaaeaba7c57f0c535accb34","head":{"label":"mapbox:5626-runtime-styling","ref":"5626-runtime-styling","sha":"2ab2ab222fc4b4aa5eaaeaba7c57f0c535accb34","user":{"login":"mapbox","id":600935,"avatar_url":"https://avatars.githubusercontent.com/u/600935?v=3","gravatar_id":"","url":"https://api.github.com/users/mapbox","html_url":"https://github.com/mapbox","followers_url":"https://api.github.com/users/mapbox/followers","following_url":"https://api.github.com/users/mapbox/following{/other_user}","gists_url":"https://api.github.com/users/mapbox/gists{/gist_id}","starred_url":"https://api.github.com/users/mapbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapbox/subscriptions","organizations_url":"https://api.github.com/users/mapbox/orgs","repos_url":"https://api.github.com/users/mapbox/repos","events_url":"https://api.github.com/users/mapbox/events{/privacy}","received_events_url":"https://api.github.com/users/mapbox/received_events","type":"Organization","site_admin":false},"repo":{"id":16286131,"name":"mapbox-gl-native","full_name":"mapbox/mapbox-gl-native","owner":{"login":"mapbox","id":600935,"avatar_url":"https://avatars.githubusercontent.com/u/600935?v=3","gravatar_id":"","url":"https://api.github.com/users/mapbox","html_url":"https://github.com/mapbox","followers_url":"https://api.github.com/users/mapbox/followers","following_url":"https://api.github.com/users/mapbox/following{/other_user}","gists_url":"https://api.github.com/users/mapbox/gists{/gist_id}","starred_url":"https://api.github.com/users/mapbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapbox/subscriptions","organizations_url":"https://api.github.com/users/mapbox/orgs","repos_url":"https://api.github.com/users/mapbox/repos","events_url":"https://api.github.com/users/mapbox/events{/privacy}","received_events_url":"https://api.github.com/users/mapbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapbox/mapbox-gl-native","description":"Render Mapbox styles in mobile, desktop, and node applications using C++ and OpenGL","fork":false,"url":"https://api.github.com/repos/mapbox/mapbox-gl-native","forks_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/forks","keys_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/teams","hooks_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/hooks","issue_events_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/events{/number}","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/events","assignees_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/assignees{/user}","branches_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/branches{/branch}","tags_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/tags","blobs_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/statuses/{sha}","languages_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/languages","stargazers_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/stargazers","contributors_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/contributors","subscribers_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/subscribers","subscription_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/subscription","commits_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/contents/{+path}","compare_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/merges","archive_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/downloads","issues_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues{/number}","pulls_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls{/number}","milestones_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/milestones{/number}","notifications_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels{/name}","releases_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/releases{/id}","deployments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/deployments","created_at":"2014-01-27T17:14:48Z","updated_at":"2016-07-21T14:43:06Z","pushed_at":"2016-07-21T14:23:38Z","git_url":"git://github.com/mapbox/mapbox-gl-native.git","ssh_url":"git@github.com:mapbox/mapbox-gl-native.git","clone_url":"https://github.com/mapbox/mapbox-gl-native.git","svn_url":"https://github.com/mapbox/mapbox-gl-native","homepage":"https://mapbox.com/mobile","size":114285,"stargazers_count":1371,"watchers_count":1371,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":372,"mirror_url":null,"open_issues_count":514,"forks":372,"open_issues":514,"watchers":1371,"default_branch":"master"}},"base":{"label":"mapbox:master","ref":"master","sha":"03ebae0f2ed0e5ff2c4fe284d8d3db8960ae4938","user":{"login":"mapbox","id":600935,"avatar_url":"https://avatars.githubusercontent.com/u/600935?v=3","gravatar_id":"","url":"https://api.github.com/users/mapbox","html_url":"https://github.com/mapbox","followers_url":"https://api.github.com/users/mapbox/followers","following_url":"https://api.github.com/users/mapbox/following{/other_user}","gists_url":"https://api.github.com/users/mapbox/gists{/gist_id}","starred_url":"https://api.github.com/users/mapbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapbox/subscriptions","organizations_url":"https://api.github.com/users/mapbox/orgs","repos_url":"https://api.github.com/users/mapbox/repos","events_url":"https://api.github.com/users/mapbox/events{/privacy}","received_events_url":"https://api.github.com/users/mapbox/received_events","type":"Organization","site_admin":false},"repo":{"id":16286131,"name":"mapbox-gl-native","full_name":"mapbox/mapbox-gl-native","owner":{"login":"mapbox","id":600935,"avatar_url":"https://avatars.githubusercontent.com/u/600935?v=3","gravatar_id":"","url":"https://api.github.com/users/mapbox","html_url":"https://github.com/mapbox","followers_url":"https://api.github.com/users/mapbox/followers","following_url":"https://api.github.com/users/mapbox/following{/other_user}","gists_url":"https://api.github.com/users/mapbox/gists{/gist_id}","starred_url":"https://api.github.com/users/mapbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapbox/subscriptions","organizations_url":"https://api.github.com/users/mapbox/orgs","repos_url":"https://api.github.com/users/mapbox/repos","events_url":"https://api.github.com/users/mapbox/events{/privacy}","received_events_url":"https://api.github.com/users/mapbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapbox/mapbox-gl-native","description":"Render Mapbox styles in mobile, desktop, and node applications using C++ and OpenGL","fork":false,"url":"https://api.github.com/repos/mapbox/mapbox-gl-native","forks_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/forks","keys_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/teams","hooks_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/hooks","issue_events_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/events{/number}","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/events","assignees_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/assignees{/user}","branches_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/branches{/branch}","tags_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/tags","blobs_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/statuses/{sha}","languages_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/languages","stargazers_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/stargazers","contributors_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/contributors","subscribers_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/subscribers","subscription_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/subscription","commits_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/contents/{+path}","compare_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/merges","archive_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/downloads","issues_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues{/number}","pulls_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls{/number}","milestones_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/milestones{/number}","notifications_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels{/name}","releases_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/releases{/id}","deployments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/deployments","created_at":"2014-01-27T17:14:48Z","updated_at":"2016-07-21T14:43:06Z","pushed_at":"2016-07-21T14:23:38Z","git_url":"git://github.com/mapbox/mapbox-gl-native.git","ssh_url":"git@github.com:mapbox/mapbox-gl-native.git","clone_url":"https://github.com/mapbox/mapbox-gl-native.git","svn_url":"https://github.com/mapbox/mapbox-gl-native","homepage":"https://mapbox.com/mobile","size":114285,"stargazers_count":1371,"watchers_count":1371,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":372,"mirror_url":null,"open_issues_count":514,"forks":372,"open_issues":514,"watchers":1371,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/5727"},"html":{"href":"https://github.com/mapbox/mapbox-gl-native/pull/5727"},"issue":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/5727"},"comments":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/5727/comments"},"review_comments":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/5727/comments"},"review_comment":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/5727/commits"},"statuses":{"href":"https://api.github.com/repos/mapbox/mapbox-gl-native/statuses/2ab2ab222fc4b4aa5eaaeaba7c57f0c535accb34"}}}}
{"actor":{"display_login":"1ec5"}}