Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dwarvesf/CodeViewer
A custom code editor SwiftUI view
https://github.com/dwarvesf/CodeViewer
codeviewer ios macos swift swiftui
Last synced: 8 days ago
JSON representation
A custom code editor SwiftUI view
- Host: GitHub
- URL: https://github.com/dwarvesf/CodeViewer
- Owner: dwarvesf
- License: mit
- Created: 2020-08-26T08:08:20.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-28T15:37:31.000Z (over 1 year ago)
- Last Synced: 2023-11-07T19:52:43.518Z (about 1 year ago)
- Topics: codeviewer, ios, macos, swift, swiftui
- Language: JavaScript
- Homepage:
- Size: 2.24 MB
- Stars: 128
- Watchers: 6
- Forks: 13
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - CodeViewer - A custom code editor SwiftUI view (swiftui)
- awesome - CodeViewer - A custom code editor SwiftUI view (swiftui)
README
# CodeViewer
CodeViewer is a custom code editor SwiftUI view, which wrap around the [ace](http://ace.c9.io) editor.
## Features
- [x] Darkmode, lightmode adopt automatically
- [x] Syntax highlighting for over 110 languages (TextMate/Sublime Text.tmlanguage files can be imported)
- [x] Over 20 themes (TextMate/Sublime Text .tmtheme files can be imported)
- [x] Support SwiftUI## Usage
```Swift
import SwiftUI
import CodeViewerstruct ContentView: View {
@State private var json = ""
var body: some View {
CodeViewer(
content: $json,
mode: .json,
darkTheme: .solarized_dark,
lightTheme: .solarized_light,
isReadOnly: true,
fontSize: 54
)
.onAppear {
json = """
{
"hello": "world"
}
"""
}
}
}```
## Requirement
- iOS >= v13
- macOS >= v10.15