dwarvesf / CodeViewer

A custom code editor SwiftUI view
MIT License
140 stars 17 forks source link
codeviewer ios macos swift swiftui

CodeViewer

platform

CodeViewer is a custom code editor SwiftUI view, which wrap around the ace editor.

image image

Features

Usage

import SwiftUI
import CodeViewer

struct 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