Swiftpack.co - Package - dwarvesf/CodeViewer

CodeViewer

platform

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

image image

Features

  • ☑ Darkmode, lightmode adopt automatically
  • ☑ Syntax highlighting for over 110 languages (TextMate/Sublime Text.tmlanguage files can be imported)
  • ☑ Over 20 themes (TextMate/Sublime Text .tmtheme files can be imported)
  • ☑ Support SwiftUI

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

  • iOS >= v13
  • macOS >= v10.15

Github

link
Stars: 6

Dependencies

Used By

Total: 0