Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
helje5 committed Mar 19, 2024
2 parents 60e6ba6 + a772247 commit 3a92458
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Select latest available Xcode
uses: maxim-lobanov/[email protected]
with:
xcode-version: 13.2.1
xcode-version: latest
- name: Checkout Repository
uses: actions/checkout@v2
- name: Build Swift Debug Package
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,5 @@ fastlane/test_output
iOSInjectionProject/

Package.resolved
.swiftpm

26 changes: 26 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// swift-tools-version:5.10

import PackageDescription

let package = Package(

name: "CodeEditor",

platforms: [
.macOS(.v10_15), .iOS(.v13), .visionOS(.v1), .watchOS(.v7), .tvOS(.v12)
],

products: [
.library(name: "CodeEditor", targets: [ "CodeEditor" ])
],

dependencies: [
// Temporary, until upstream PR is merged.
//.package(url: "https://github.com/raspu/Highlightr", from: "2.1.2")
.package(url: "https://github.com/helje5/Highlightr", from: "3.0.2")
],

targets: [
.target(name: "CodeEditor", dependencies: [ "Highlightr" ])
]
)
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
</h2>

![SwiftUI](https://img.shields.io/badge/SwiftUI-orange.svg)
![Swift5.3](https://img.shields.io/badge/swift-5.3-blue.svg)
![Swift5](https://img.shields.io/badge/swift-5-blue.svg)
![macOS](https://img.shields.io/badge/os-macOS-green.svg?style=flat)
![iOS](https://img.shields.io/badge/os-iOS-green.svg?style=flat)
![visionOS](https://img.shields.io/badge/os-visionOS-green.svg?style=flat)
[![Build and Test](https://github.com/ZeeZide/CodeEditor/actions/workflows/swift.yml/badge.svg?branch=main)](https://github.com/ZeeZide/CodeEditor/actions/workflows/swift.yml)

A [SwiftUI](https://developer.apple.com/xcode/swiftui/)
Expand Down
86 changes: 43 additions & 43 deletions Sources/CodeEditor/Language.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
// CodeEditor
//
// Created by Helge Heß.
// Copyright © 2021 ZeeZide GmbH. All rights reserved.
// Copyright © 2021-2024 ZeeZide GmbH. All rights reserved.
//

public extension CodeEditor {

@frozen
struct Language: TypedString {
struct Language: TypedString, Sendable {

public let rawValue : String

Expand All @@ -20,45 +20,45 @@ public extension CodeEditor {

public extension CodeEditor.Language {

static var accesslog = CodeEditor.Language(rawValue: "accesslog")
static var actionscript = CodeEditor.Language(rawValue: "actionscript")
static var ada = CodeEditor.Language(rawValue: "ada")
static var apache = CodeEditor.Language(rawValue: "apache")
static var applescript = CodeEditor.Language(rawValue: "applescript")
static var bash = CodeEditor.Language(rawValue: "bash")
static var basic = CodeEditor.Language(rawValue: "basic")
static var brainfuck = CodeEditor.Language(rawValue: "brainfuck")
static var c = CodeEditor.Language(rawValue: "c")
static var cpp = CodeEditor.Language(rawValue: "cpp")
static var cs = CodeEditor.Language(rawValue: "cs")
static var css = CodeEditor.Language(rawValue: "css")
static var diff = CodeEditor.Language(rawValue: "diff")
static var dockerfile = CodeEditor.Language(rawValue: "dockerfile")
static var go = CodeEditor.Language(rawValue: "go")
static var http = CodeEditor.Language(rawValue: "http")
static var java = CodeEditor.Language(rawValue: "java")
static var javascript = CodeEditor.Language(rawValue: "javascript")
static var json = CodeEditor.Language(rawValue: "json")
static var lua = CodeEditor.Language(rawValue: "lua")
static var markdown = CodeEditor.Language(rawValue: "markdown")
static var makefile = CodeEditor.Language(rawValue: "makefile")
static var nginx = CodeEditor.Language(rawValue: "nginx")
static var objectivec = CodeEditor.Language(rawValue: "objectivec")
static var pgsql = CodeEditor.Language(rawValue: "pgsql")
static var php = CodeEditor.Language(rawValue: "php")
static var python = CodeEditor.Language(rawValue: "python")
static var ruby = CodeEditor.Language(rawValue: "ruby")
static var rust = CodeEditor.Language(rawValue: "rust")
static var shell = CodeEditor.Language(rawValue: "shell")
static var smalltalk = CodeEditor.Language(rawValue: "smalltalk")
static var sql = CodeEditor.Language(rawValue: "sql")
static var swift = CodeEditor.Language(rawValue: "swift")
static var tcl = CodeEditor.Language(rawValue: "tcl")
static var tex = CodeEditor.Language(rawValue: "tex")
static var twig = CodeEditor.Language(rawValue: "twig")
static var typescript = CodeEditor.Language(rawValue: "typescript")
static var vbnet = CodeEditor.Language(rawValue: "vbnet")
static var vbscript = CodeEditor.Language(rawValue: "vbscript")
static var xml = CodeEditor.Language(rawValue: "xml")
static var yaml = CodeEditor.Language(rawValue: "yaml")
@inlinable static var accesslog : Self { Self(rawValue: "accesslog") }
@inlinable static var actionscript : Self { Self(rawValue: "actionscript") }
@inlinable static var ada : Self { Self(rawValue: "ada") }
@inlinable static var apache : Self { Self(rawValue: "apache") }
@inlinable static var applescript : Self { Self(rawValue: "applescript") }
@inlinable static var bash : Self { Self(rawValue: "bash") }
@inlinable static var basic : Self { Self(rawValue: "basic") }
@inlinable static var brainfuck : Self { Self(rawValue: "brainfuck") }
@inlinable static var c : Self { Self(rawValue: "c") }
@inlinable static var cpp : Self { Self(rawValue: "cpp") }
@inlinable static var cs : Self { Self(rawValue: "cs") }
@inlinable static var css : Self { Self(rawValue: "css") }
@inlinable static var diff : Self { Self(rawValue: "diff") }
@inlinable static var dockerfile : Self { Self(rawValue: "dockerfile") }
@inlinable static var go : Self { Self(rawValue: "go") }
@inlinable static var http : Self { Self(rawValue: "http") }
@inlinable static var java : Self { Self(rawValue: "java") }
@inlinable static var javascript : Self { Self(rawValue: "javascript") }
@inlinable static var json : Self { Self(rawValue: "json") }
@inlinable static var lua : Self { Self(rawValue: "lua") }
@inlinable static var markdown : Self { Self(rawValue: "markdown") }
@inlinable static var makefile : Self { Self(rawValue: "makefile") }
@inlinable static var nginx : Self { Self(rawValue: "nginx") }
@inlinable static var objectivec : Self { Self(rawValue: "objectivec") }
@inlinable static var pgsql : Self { Self(rawValue: "pgsql") }
@inlinable static var php : Self { Self(rawValue: "php") }
@inlinable static var python : Self { Self(rawValue: "python") }
@inlinable static var ruby : Self { Self(rawValue: "ruby") }
@inlinable static var rust : Self { Self(rawValue: "rust") }
@inlinable static var shell : Self { Self(rawValue: "shell") }
@inlinable static var smalltalk : Self { Self(rawValue: "smalltalk") }
@inlinable static var sql : Self { Self(rawValue: "sql") }
@inlinable static var swift : Self { Self(rawValue: "swift") }
@inlinable static var tcl : Self { Self(rawValue: "tcl") }
@inlinable static var tex : Self { Self(rawValue: "tex") }
@inlinable static var twig : Self { Self(rawValue: "twig") }
@inlinable static var typescript : Self { Self(rawValue: "typescript") }
@inlinable static var vbnet : Self { Self(rawValue: "vbnet") }
@inlinable static var vbscript : Self { Self(rawValue: "vbscript") }
@inlinable static var xml : Self { Self(rawValue: "xml") }
@inlinable static var yaml : Self { Self(rawValue: "yaml") }
}
23 changes: 12 additions & 11 deletions Sources/CodeEditor/ThemeName.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
// CodeEditor
//
// Created by Helge Heß.
// Copyright © 2021 ZeeZide GmbH. All rights reserved.
// Copyright © 2021-2024 ZeeZide GmbH. All rights reserved.
//

public extension CodeEditor {

@frozen
struct ThemeName: TypedString {
struct ThemeName: TypedString, Sendable {

public let rawValue : String

Expand All @@ -20,14 +20,15 @@ public extension CodeEditor {

public extension CodeEditor.ThemeName {

static var `default` = pojoaque
@inlinable static var `default` : Self { pojoaque }
@inlinable static var pojoaque : Self { Self(rawValue: "pojoaque") }
@inlinable static var agate : Self { Self(rawValue: "agate") }
@inlinable static var ocean : Self { Self(rawValue: "ocean") }

static var pojoaque = CodeEditor.ThemeName(rawValue: "pojoaque")
static var agate = CodeEditor.ThemeName(rawValue: "agate")
static var ocean = CodeEditor.ThemeName(rawValue: "ocean")

static var atelierSavannaLight =
CodeEditor.ThemeName(rawValue: "atelier-savanna-light")
static var atelierSavannaDark =
CodeEditor.ThemeName(rawValue: "atelier-savanna-dark")
@inlinable
static var atelierSavannaLight : Self {
Self(rawValue: "atelier-savanna-light") }
@inlinable
static var atelierSavannaDark : Self {
Self(rawValue: "atelier-savanna-dark") }
}
6 changes: 3 additions & 3 deletions Sources/CodeEditor/UXCodeTextViewRepresentable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ struct UXCodeTextViewRepresentable : UXViewRepresentable {
}
textViewDidChange(textView: textView)
}
#elseif os(iOS)
#elseif os(iOS) || os(visionOS)
public func textViewDidChange(_ textView: UITextView) {
textViewDidChange(textView: textView)
}
Expand Down Expand Up @@ -139,7 +139,7 @@ struct UXCodeTextViewRepresentable : UXViewRepresentable {

textViewDidChangeSelection(textView: textView as! UXCodeTextView)
}
#elseif os(iOS)
#elseif os(iOS) || os(visionOS)
public func textViewDidChangeSelection(_ textView: UITextView) {
textViewDidChangeSelection(textView: textView as! UXCodeTextView)
}
Expand Down Expand Up @@ -214,7 +214,7 @@ struct UXCodeTextViewRepresentable : UXViewRepresentable {
let nsrange = NSRange(range, in: textView.string)
#if os(macOS)
textView.setSelectedRange(nsrange)
#elseif os(iOS)
#elseif os(iOS) || os(visionOS)
textView.selectedRange = nsrange
#else
#error("Unsupported OS")
Expand Down

0 comments on commit 3a92458

Please sign in to comment.