README.md
October 11, 2021 ยท View on GitHub
CodeMirror-Swift is a lightweight wrapper of CodeMirror for macOS and iOS.
Features
- ๐ญ Lightweight CodeMirror wrapper (build 5.52.2)
- โ 100% Native Swift 5 and modern WKWebView
- ๐ Support iOS & macOS
- ๐ง Built-in addons
- ๐ Customizable (Addon, Themes, Modes...)
- ๐ Dozen built-in themes and syntax highlight modes
- โก๏ธ Ready to go
Apps that uses CodeMirror-Swift
Modern and Delightful HTTP Debugging Proxy for macOS, iOS and Android โก๏ธ โข ๐ https://proxyman.io
Installation
SPM
The easiest way to use this package is to add https://github.com/ProxymanApp/CodeMirror-Swift to your SPM dependency.
Manually
- Manually copy
CodeMirrorWebView.swiftandCodeMirrorView.bundleto your project. - Customize to fit your need on
index.html - Set
modeandContent
let url = Bundle.main.url(forResource: "data", withExtension: "json")!
let content = try! String(contentsOf: url)
codeMirrorView.setMimeType("application/json")
codeMirrorView.setContent(content)
Example
- Run
./examples/CodeMirror-Swift-Example.xcodeproj
How to use addons?
- Read CodeMirror Documentation
- Enable your plugins in
index.html
How to add new themes?
- Download CodeMirrror themes and put it on the folder
Sources/CodeMirrorView.bundle/Contents/Resources/theme - Load your theme in
index.html - Change by using
codeMirrorView.setThemeName("material.css")
Credit
- CodeMirror: https://codemirror.net
- CodeMirror-minified: https://www.npmjs.com/package/codemirror-minified
- Pierre-Olivier Latour: https://github.com/swisspol/CodeMirrorView
License
CodeMirror-Swift is copyright 2020 Proxyman and available under MIT license. See the LICENSE file in the project for more information.