{"id":17129730,"url":"https://github.com/lm2343635/mgformatter","last_synced_at":"2025-04-13T07:21:26.130Z","repository":{"id":54999139,"uuid":"100157453","full_name":"lm2343635/MGFormatter","owner":"lm2343635","description":"A JSON string formatter running on iOS","archived":false,"fork":false,"pushed_at":"2021-01-16T14:50:36.000Z","size":785,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T12:14:51.744Z","etag":null,"topics":["html-format","ios-lib","json-format","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lm2343635.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-13T06:05:54.000Z","updated_at":"2022-05-26T09:56:28.000Z","dependencies_parsed_at":"2022-08-14T08:40:27.537Z","dependency_job_id":null,"html_url":"https://github.com/lm2343635/MGFormatter","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lm2343635%2FMGFormatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lm2343635%2FMGFormatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lm2343635%2FMGFormatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lm2343635%2FMGFormatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lm2343635","download_url":"https://codeload.github.com/lm2343635/MGFormatter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248676356,"owners_count":21143915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html-format","ios-lib","json-format","swift"],"created_at":"2024-10-14T19:10:30.155Z","updated_at":"2025-04-13T07:21:26.098Z","avatar_url":"https://github.com/lm2343635.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MGFormatter\n\n![Swift 5.0](https://img.shields.io/badge/Swift-5.0-orange.svg)\n![build_check](https://github.com/lm2343635/MGFormatter/workflows/build_check/badge.svg)\n[![Version](https://img.shields.io/cocoapods/v/MGFormatter.svg?style=flat)](http://cocoapods.org/pods/MGFormatter)\n[![License](https://img.shields.io/cocoapods/l/MGFormatter.svg?style=flat)](http://cocoapods.org/pods/MGFormatter)\n[![Platform](https://img.shields.io/cocoapods/p/MGFormatter.svg?style=flat)](http://cocoapods.org/pods/MGFormatter)\n\nMGFormatter can format the JSON or HTML code in a view with customized keyword color and font.\n\u003cdiv\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/lm2343635/MGFormatter/master/screenshot/json-dark.png\" width=\"300\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/lm2343635/MGFormatter/master/screenshot/html-dark.png\" width=\"300\"\u003e\n\u003c/div\u003e\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Requirements\n\n- iOS 8.0+\n- Xcode 9.0+\n\n## Usage\n\nJust create a **FormatterView** and set the code you want to format.\n\n```Swift\nformatterView.format(string: utf8Text, style: .jsonDark)\n```\n\n### About style\n\nThe follow style can be customized be the developers.\n\n- Formatter type(JSON or HTML) and the colors of key words.\n- Font.\n- Line spacing.\n\nDark and light style can be used directly.\n\n### Supported code style and colors\n\nThe following colors of keywords can be customized.\n\n- JSON type\n\t- normal\n\t- attribute\n\t- boolean\n\t- string\n\t- number\n- HTML\n\t- normal\n\t- tag\n\t- attribute name\n\t- attribute value\n\nHere is the demo code for customized style.\n\n```Swift\nlet color = JSONColor(\n    normal: .white,\n    attribute: .yellow,\n    boolean: .green,\n    string: .cyan,\n    number: .orange\n)\nlet style = FormatterStyle(font: UIFont.systemFont(ofSize: 12), lineSpacing: 5, type: .json(JSONColor()))\nself.formatterView.format(string: utf8Text, style: style)\n```\n\n## Installation\n\nMGFormatter is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'MGFormatter'\n```\n\n## Author\n\nMeng Li, lm2343635@126.com\n\n## License\n\nMGFormatter is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flm2343635%2Fmgformatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flm2343635%2Fmgformatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flm2343635%2Fmgformatter/lists"}