{"id":13770940,"url":"https://github.com/Upstarts/editor.js-kit-ios","last_synced_at":"2025-05-11T03:32:57.952Z","repository":{"id":34996308,"uuid":"193479362","full_name":"Upstarts/editor.js-kit-ios","owner":"Upstarts","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-18T09:15:01.000Z","size":1582,"stargazers_count":31,"open_issues_count":3,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-17T16:09:39.304Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Upstarts.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-24T09:54:43.000Z","updated_at":"2024-11-10T16:25:19.000Z","dependencies_parsed_at":"2024-08-03T17:14:07.377Z","dependency_job_id":null,"html_url":"https://github.com/Upstarts/editor.js-kit-ios","commit_stats":{"total_commits":83,"total_committers":6,"mean_commits":"13.833333333333334","dds":0.6626506024096386,"last_synced_commit":"0be2259559ce9dacd5e34b5f329ac8a19f9d8273"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Upstarts%2Feditor.js-kit-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Upstarts%2Feditor.js-kit-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Upstarts%2Feditor.js-kit-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Upstarts%2Feditor.js-kit-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Upstarts","download_url":"https://codeload.github.com/Upstarts/editor.js-kit-ios/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253514352,"owners_count":21920327,"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":[],"created_at":"2024-08-03T17:00:45.132Z","updated_at":"2025-05-11T03:32:57.316Z","avatar_url":"https://github.com/Upstarts.png","language":"Swift","funding_links":[],"categories":["Libraries"],"sub_categories":["Swift"],"readme":"\n\u003cp align=\"center\"\u003e\n\u003cpicture width=400\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://static.upstarts.work/ejkit/logo-dark.png?\"\u003e\n  \u003cimg src=\"https://static.upstarts.work/ejkit/logo-light.png?\" width=400\u003e\n\u003c/picture\u003e\n\u003c/p\u003e\n\n[![Version](https://img.shields.io/cocoapods/v/EditorJSKit.svg?style=flat)](https://cocoapods.org/pods/EditorJSKit)\n[![License](https://img.shields.io/cocoapods/l/EditorJSKit.svg?style=flat)](https://cocoapods.org/pods/EditorJSKit)\n[![Platform](https://img.shields.io/cocoapods/p/EditorJSKit.svg?style=flat)](https://cocoapods.org/pods/EditorJSKit)\n\n## About\n\nA non-official iOS Framework for [Editor.js](https://editorjs.io) - block styled editor. It's purpose to make easy use of rendering and parsing of blocks.\n\nConverts clean json blocks data like [this](Example/EditorJSKit/EditorJSMock.json) into native views like that 👇\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://static.upstarts.work/ejkit/editorjs.kit-ios-scr.png?\" width=420 /\u003e\n\u003c/p\u003e\n\n#### Supported blocks\n* 🎩 Header\n* 🥑 Raw HTML\n* 📷 Image\n* 🖌 Delimiter\n* 💌 Paragraph\n* 🕸 Link\n* 🌿 List\n\n#### TODO's\n* 📋 Table block support\n* `UITableView` rendering\n* Documentation on how to apply custom styles\n* Documentation on how to create custom blocks\n* Documentation on how to create custom renderers\n\n## Developers note\nEssentially the Kit is built on multiple levels of abstractions. It is pretty handy since it provides an ability to customize the behavior of rendering clean json data and adding custom blocks.\n\nNote that the framework has a built-in protocol-oriented tools to implement your own adapters, renderers and custom blocks. These features are not documented yet, we're working on it. \n\n## Usage\nFor now we only support blocks rendering within a `UICollectionView` out of the box. If your collection view contains only EJ blocks, use `EJCollectionViewAdapter`, it encapsulates collection's dataSource and delegate and is super easy to use. \n\nHere's the example of `EJCollectionViewAdapter` usage: \n\n1. Create an instance of kit:\n``` swift\nlet kit = EJKit.shared\n```\n\n2. Decode your data to `EJBLockList` (array of json blocks): \n``` swift\nlet blockList = try kit.decode(data: data)\n```\n\n3. Inside of your ViewController create a `collectionView`:\n``` swift\nlazy var collectionView = UICollectionView(frame: view.bounds, collectionViewLayout: UICollectionViewFlowLayout())\n```\n\n4. Create an adapter:\n``` swift\nlazy var adapter = EJCollectionViewAdapter(collectionView: collectionView)\n```\n\n5. Confirm to `EJCollectionDataSource` and return your parsed blocks in the `data` variable.\n``` swift\nextension ViewController: EJCollectionDataSource {\n    var data: EJBlocksList? { blockList }\n}\n```\n\n6. Assign your `ViewController` to `adapter`'s `dataSource`\n``` swift\noverride func viewDidLoad() {\n    super.viewDidLoad()\n    adapter.dataSource = self\n}\n```\n\nIn case you'd like to mix EJ blocks with some other cells, use `EJCollectionRenderer`. It provides you with more flexibility, here's how to use it:\n\n1. Repeat steps 1-3 from the guide above.\n\n2. Create a renderer:\n``` swift\nlazy var renderer = EJCollectionRenderer(collectionView: collectionView)\n```\n\n3. Implement and assign collection's data source and delegate methods.\n``` swift\n///\nextension ViewController: UICollectionViewDataSource {\n    \n    /**\n     */\n    func numberOfSections(in collectionView: UICollectionView) -\u003e Int {\n        return blockList.blocks.count\n    }\n    \n    /**\n     */\n    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -\u003e Int {\n        return blockList.blocks[section].data.numberOfItems\n    }\n    \n    /**\n     */    \n    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -\u003e UICollectionViewCell {\n        do {\n            let block = blockList.blocks[indexPath.section]\n            let style = kit.style.getStyle(forBlockType: block.type)\n            return try renderer.render(block: block, indexPath: indexPath, style: style)\n        }\n        catch {\n            // Ensure you won't ever get here\n            return UICollectionViewCell()\n        }\n    }\n}\n\n///\nextension ViewController: UICollectionViewDelegateFlowLayout {\n\n    /**\n     */\n    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -\u003e CGSize {\n        do {\n            let block = blockList.blocks[indexPath.section]\n            let style = kit.style.getStyle(forBlockType: block.type)\n            return try renderer.size(forBlock: block,\n                                     itemIndex: indexPath.item,\n                                     style: style,\n                                     superviewSize: collectionView.frame.size)\n        } catch {\n            return .zero\n        }\n    }\n    \n    /**\n     */\n    public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -\u003e CGFloat {\n        return renderer.spacing(forBlock: blockList.blocks[section])\n    }\n    \n    /**\n     */\n    public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -\u003e UIEdgeInsets {\n        return renderer.insets(forBlock: blockList.blocks[section])\n    }\n}\n``` \n\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Installation\n\nEditorJSKit is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'EditorJSKit'\n```\n\n## Author\n\n[Upstarts team](https://upstarts.work)\n\n[Vadim Popov](https://github.com/PopovVadim) - Architecture, implementation, code review\n\n[Ivan Glushko](https://github.com/ivanglushko) - Implementation\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUpstarts%2Feditor.js-kit-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FUpstarts%2Feditor.js-kit-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUpstarts%2Feditor.js-kit-ios/lists"}