All Projects → mchakravarty → CodeEditorView

mchakravarty / CodeEditorView

Licence: Apache-2.0 license
SwiftUI code editor view for iOS and macOS

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to CodeEditorView

open2fa
Two-factor authentication app with import/export for iOS and macOS. All codes encrypted with AES 256. FaceID & TouchID support included. Written with love in SwiftUI ❤️
Stars: ✭ 24 (-94.79%)
Mutual labels:  swiftui
ridesharing-ios
Ridesharing driver & rider sample apps using HyperTrack SDK
Stars: ✭ 97 (-78.96%)
Mutual labels:  swiftui
99StocksSwiftUI
SwiftUI app that fetches a list of companies, sort them by their share price and can show its details on a separate view
Stars: ✭ 34 (-92.62%)
Mutual labels:  swiftui
AudioKitUI
Controls and Visualization for AudioKit apps
Stars: ✭ 126 (-72.67%)
Mutual labels:  swiftui
SwiftDown
📦 A themable markdown editor component for your SwiftUI apps.
Stars: ✭ 203 (-55.97%)
Mutual labels:  swiftui
SwiftUIDemo
A demo app showing you how to build a table view and navigation interface with SwiftUI
Stars: ✭ 26 (-94.36%)
Mutual labels:  swiftui
mobilePillowTalkLite
An iOS & SwiftUI server monitor tool for linux based machines using remote proc file system with script execution.
Stars: ✭ 421 (-8.68%)
Mutual labels:  swiftui
spiro
Swift Playgrounds 4 app created on the iPad
Stars: ✭ 48 (-89.59%)
Mutual labels:  swiftui
paragon firewall ce
Paragon Firewall for Mac
Stars: ✭ 63 (-86.33%)
Mutual labels:  swiftui
Relay.swift
Relay for GraphQL, ported to Swift and SwiftUI
Stars: ✭ 58 (-87.42%)
Mutual labels:  swiftui
DownloadFullInstaller
macOS application written in SwiftUI that downloads installer pkgs for the Install macOS Big Sur application.
Stars: ✭ 678 (+47.07%)
Mutual labels:  swiftui
Apple-Developer-Roadmap
Cómo convertirte en Apple Developer (iOS, iPadOS, macOS, watchOS, tvOS)
Stars: ✭ 381 (-17.35%)
Mutual labels:  swiftui
TheatricalMovieTrailers
iOS & macOS app written in SwiftUI that provides a nice trailer watching experience.
Stars: ✭ 27 (-94.14%)
Mutual labels:  swiftui
StarWars
Minimal GraphQL based Jetpack Compose, Wear Compose and SwiftUI Kotlin Multiplatform sample (using StarWars endpoint - https://graphql.org/swapi-graphql)
Stars: ✭ 165 (-64.21%)
Mutual labels:  swiftui
figma-preview-swiftui
Figma component preview for your SwiftUI views
Stars: ✭ 51 (-88.94%)
Mutual labels:  swiftui
Solstice
🌅 An app that tells you how the daylight is changing
Stars: ✭ 41 (-91.11%)
Mutual labels:  swiftui
Slipbox
The project is using Core Data with iCloud sync. It is a cross-platform app for iOS and macOS written in SwiftUI.
Stars: ✭ 49 (-89.37%)
Mutual labels:  swiftui
Windows11
💻 Windows 11 in SwiftUI.
Stars: ✭ 177 (-61.61%)
Mutual labels:  swiftui
o-fish-ios
iOS app for the Officer's Fishery Information Sharing Hub (O-FISH). The mobile app allows fisheries officers to document and share critical information gathered during a routine vessel inspection.
Stars: ✭ 28 (-93.93%)
Mutual labels:  swiftui
MultiModal
Use multiple .sheet, .alert, etc. modifiers in the same SwiftUI View
Stars: ✭ 49 (-89.37%)
Mutual labels:  swiftui

SwiftUI code editor view for iOS and macOS

The CodeEditorView Swift package provides a SwiftUI view implementing a rich code editor for iOS and macOS whose visual style is inspired by Xcode. The currently supported functionality includes syntax highlighting with configurable themes, inline message (warnings, errors, etc) reporting, bracket matching, matching bracket insertion, current line highlighting, and a minimap (only on macOS).

Screenshots of the demo app

This is the default dark theme on macOS. Like in Xcode, messages have got an inline view on the right-hand side of the screen, which pops up into a larger overlay to display more information. The minimap on the right provides an outline of the edited text.

The following is the default light theme on iOS. Both line highlighting and the minimap are currently not supported on iOS due to limitations in the iOS version of TextKit. Instead of the line highlight, both the current line (or the current selection range) and lines with messages are indicated with differently coloured line numbers in the gutter.

How to use it

Typical usage of the view is as follows.

struct ContentView: View {
  @State private var text:     String                = "My awesome code..."
  @State private var position: CodeEditor.Position  = CodeEditor.Position()
  @State private var messages: Set<Located<Message>> = Set()

  @Environment(\.colorScheme) private var colorScheme: ColorScheme

  var body: some View {
    CodeEditor(text: $text, position: $position, messages: $messages, language: .swift)
      .environment(\.codeEditorTheme,
                   colorScheme == .dark ? Theme.defaultDark : Theme.defaultLight)
  }
}

Demo app

To see the CodeEditorView in action, have a look at the repo with a cross-platform demo app.

Documentation

For more information, see the package documentation.

Status

I consider this to be pre-release quality. It is sufficient to start building something on it, but it is not yet ready for production. While the CodeEditor view already supports quite a bit of advanced functionality (such as the inline messages and minimap), other components are still quite simple, such as the range of tokens covered by the language configuration. Moreover, performance is still an issue that needs to be addressed. The core architecture, such as the incremental tokenisation for syntax highlighting, is designed to handle larger files smoothly, but the overall implementation still needs some performance debugging.

License

Copyright [2021..2022] Manuel M. T. Chakravarty.

Distributed under the Apache-2.0 license — see the license file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].