Skip to content

Commit 3a92458

Browse files
committed
Merge branch 'develop'
2 parents 60e6ba6 + a772247 commit 3a92458

7 files changed

Lines changed: 88 additions & 59 deletions

File tree

.github/workflows/swift.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Select latest available Xcode
1414
uses: maxim-lobanov/setup-xcode@v1.2.1
1515
with:
16-
xcode-version: 13.2.1
16+
xcode-version: latest
1717
- name: Checkout Repository
1818
uses: actions/checkout@v2
1919
- name: Build Swift Debug Package

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,5 @@ fastlane/test_output
9090
iOSInjectionProject/
9191

9292
Package.resolved
93+
.swiftpm
9394

Package@swift-5.10.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// swift-tools-version:5.10
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
7+
name: "CodeEditor",
8+
9+
platforms: [
10+
.macOS(.v10_15), .iOS(.v13), .visionOS(.v1), .watchOS(.v7), .tvOS(.v12)
11+
],
12+
13+
products: [
14+
.library(name: "CodeEditor", targets: [ "CodeEditor" ])
15+
],
16+
17+
dependencies: [
18+
// Temporary, until upstream PR is merged.
19+
//.package(url: "https://github.com/raspu/Highlightr", from: "2.1.2")
20+
.package(url: "https://github.com/helje5/Highlightr", from: "3.0.2")
21+
],
22+
23+
targets: [
24+
.target(name: "CodeEditor", dependencies: [ "Highlightr" ])
25+
]
26+
)

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
</h2>
66

77
![SwiftUI](https://img.shields.io/badge/SwiftUI-orange.svg)
8-
![Swift5.3](https://img.shields.io/badge/swift-5.3-blue.svg)
8+
![Swift5](https://img.shields.io/badge/swift-5-blue.svg)
99
![macOS](https://img.shields.io/badge/os-macOS-green.svg?style=flat)
1010
![iOS](https://img.shields.io/badge/os-iOS-green.svg?style=flat)
11+
![visionOS](https://img.shields.io/badge/os-visionOS-green.svg?style=flat)
1112
[![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)
1213

1314
A [SwiftUI](https://developer.apple.com/xcode/swiftui/)

Sources/CodeEditor/Language.swift

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
// CodeEditor
44
//
55
// Created by Helge Heß.
6-
// Copyright © 2021 ZeeZide GmbH. All rights reserved.
6+
// Copyright © 2021-2024 ZeeZide GmbH. All rights reserved.
77
//
88

99
public extension CodeEditor {
1010

1111
@frozen
12-
struct Language: TypedString {
12+
struct Language: TypedString, Sendable {
1313

1414
public let rawValue : String
1515

@@ -20,45 +20,45 @@ public extension CodeEditor {
2020

2121
public extension CodeEditor.Language {
2222

23-
static var accesslog = CodeEditor.Language(rawValue: "accesslog")
24-
static var actionscript = CodeEditor.Language(rawValue: "actionscript")
25-
static var ada = CodeEditor.Language(rawValue: "ada")
26-
static var apache = CodeEditor.Language(rawValue: "apache")
27-
static var applescript = CodeEditor.Language(rawValue: "applescript")
28-
static var bash = CodeEditor.Language(rawValue: "bash")
29-
static var basic = CodeEditor.Language(rawValue: "basic")
30-
static var brainfuck = CodeEditor.Language(rawValue: "brainfuck")
31-
static var c = CodeEditor.Language(rawValue: "c")
32-
static var cpp = CodeEditor.Language(rawValue: "cpp")
33-
static var cs = CodeEditor.Language(rawValue: "cs")
34-
static var css = CodeEditor.Language(rawValue: "css")
35-
static var diff = CodeEditor.Language(rawValue: "diff")
36-
static var dockerfile = CodeEditor.Language(rawValue: "dockerfile")
37-
static var go = CodeEditor.Language(rawValue: "go")
38-
static var http = CodeEditor.Language(rawValue: "http")
39-
static var java = CodeEditor.Language(rawValue: "java")
40-
static var javascript = CodeEditor.Language(rawValue: "javascript")
41-
static var json = CodeEditor.Language(rawValue: "json")
42-
static var lua = CodeEditor.Language(rawValue: "lua")
43-
static var markdown = CodeEditor.Language(rawValue: "markdown")
44-
static var makefile = CodeEditor.Language(rawValue: "makefile")
45-
static var nginx = CodeEditor.Language(rawValue: "nginx")
46-
static var objectivec = CodeEditor.Language(rawValue: "objectivec")
47-
static var pgsql = CodeEditor.Language(rawValue: "pgsql")
48-
static var php = CodeEditor.Language(rawValue: "php")
49-
static var python = CodeEditor.Language(rawValue: "python")
50-
static var ruby = CodeEditor.Language(rawValue: "ruby")
51-
static var rust = CodeEditor.Language(rawValue: "rust")
52-
static var shell = CodeEditor.Language(rawValue: "shell")
53-
static var smalltalk = CodeEditor.Language(rawValue: "smalltalk")
54-
static var sql = CodeEditor.Language(rawValue: "sql")
55-
static var swift = CodeEditor.Language(rawValue: "swift")
56-
static var tcl = CodeEditor.Language(rawValue: "tcl")
57-
static var tex = CodeEditor.Language(rawValue: "tex")
58-
static var twig = CodeEditor.Language(rawValue: "twig")
59-
static var typescript = CodeEditor.Language(rawValue: "typescript")
60-
static var vbnet = CodeEditor.Language(rawValue: "vbnet")
61-
static var vbscript = CodeEditor.Language(rawValue: "vbscript")
62-
static var xml = CodeEditor.Language(rawValue: "xml")
63-
static var yaml = CodeEditor.Language(rawValue: "yaml")
23+
@inlinable static var accesslog : Self { Self(rawValue: "accesslog") }
24+
@inlinable static var actionscript : Self { Self(rawValue: "actionscript") }
25+
@inlinable static var ada : Self { Self(rawValue: "ada") }
26+
@inlinable static var apache : Self { Self(rawValue: "apache") }
27+
@inlinable static var applescript : Self { Self(rawValue: "applescript") }
28+
@inlinable static var bash : Self { Self(rawValue: "bash") }
29+
@inlinable static var basic : Self { Self(rawValue: "basic") }
30+
@inlinable static var brainfuck : Self { Self(rawValue: "brainfuck") }
31+
@inlinable static var c : Self { Self(rawValue: "c") }
32+
@inlinable static var cpp : Self { Self(rawValue: "cpp") }
33+
@inlinable static var cs : Self { Self(rawValue: "cs") }
34+
@inlinable static var css : Self { Self(rawValue: "css") }
35+
@inlinable static var diff : Self { Self(rawValue: "diff") }
36+
@inlinable static var dockerfile : Self { Self(rawValue: "dockerfile") }
37+
@inlinable static var go : Self { Self(rawValue: "go") }
38+
@inlinable static var http : Self { Self(rawValue: "http") }
39+
@inlinable static var java : Self { Self(rawValue: "java") }
40+
@inlinable static var javascript : Self { Self(rawValue: "javascript") }
41+
@inlinable static var json : Self { Self(rawValue: "json") }
42+
@inlinable static var lua : Self { Self(rawValue: "lua") }
43+
@inlinable static var markdown : Self { Self(rawValue: "markdown") }
44+
@inlinable static var makefile : Self { Self(rawValue: "makefile") }
45+
@inlinable static var nginx : Self { Self(rawValue: "nginx") }
46+
@inlinable static var objectivec : Self { Self(rawValue: "objectivec") }
47+
@inlinable static var pgsql : Self { Self(rawValue: "pgsql") }
48+
@inlinable static var php : Self { Self(rawValue: "php") }
49+
@inlinable static var python : Self { Self(rawValue: "python") }
50+
@inlinable static var ruby : Self { Self(rawValue: "ruby") }
51+
@inlinable static var rust : Self { Self(rawValue: "rust") }
52+
@inlinable static var shell : Self { Self(rawValue: "shell") }
53+
@inlinable static var smalltalk : Self { Self(rawValue: "smalltalk") }
54+
@inlinable static var sql : Self { Self(rawValue: "sql") }
55+
@inlinable static var swift : Self { Self(rawValue: "swift") }
56+
@inlinable static var tcl : Self { Self(rawValue: "tcl") }
57+
@inlinable static var tex : Self { Self(rawValue: "tex") }
58+
@inlinable static var twig : Self { Self(rawValue: "twig") }
59+
@inlinable static var typescript : Self { Self(rawValue: "typescript") }
60+
@inlinable static var vbnet : Self { Self(rawValue: "vbnet") }
61+
@inlinable static var vbscript : Self { Self(rawValue: "vbscript") }
62+
@inlinable static var xml : Self { Self(rawValue: "xml") }
63+
@inlinable static var yaml : Self { Self(rawValue: "yaml") }
6464
}

Sources/CodeEditor/ThemeName.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
// CodeEditor
44
//
55
// Created by Helge Heß.
6-
// Copyright © 2021 ZeeZide GmbH. All rights reserved.
6+
// Copyright © 2021-2024 ZeeZide GmbH. All rights reserved.
77
//
88

99
public extension CodeEditor {
1010

1111
@frozen
12-
struct ThemeName: TypedString {
12+
struct ThemeName: TypedString, Sendable {
1313

1414
public let rawValue : String
1515

@@ -20,14 +20,15 @@ public extension CodeEditor {
2020

2121
public extension CodeEditor.ThemeName {
2222

23-
static var `default` = pojoaque
23+
@inlinable static var `default` : Self { pojoaque }
24+
@inlinable static var pojoaque : Self { Self(rawValue: "pojoaque") }
25+
@inlinable static var agate : Self { Self(rawValue: "agate") }
26+
@inlinable static var ocean : Self { Self(rawValue: "ocean") }
2427

25-
static var pojoaque = CodeEditor.ThemeName(rawValue: "pojoaque")
26-
static var agate = CodeEditor.ThemeName(rawValue: "agate")
27-
static var ocean = CodeEditor.ThemeName(rawValue: "ocean")
28-
29-
static var atelierSavannaLight =
30-
CodeEditor.ThemeName(rawValue: "atelier-savanna-light")
31-
static var atelierSavannaDark =
32-
CodeEditor.ThemeName(rawValue: "atelier-savanna-dark")
28+
@inlinable
29+
static var atelierSavannaLight : Self {
30+
Self(rawValue: "atelier-savanna-light") }
31+
@inlinable
32+
static var atelierSavannaDark : Self {
33+
Self(rawValue: "atelier-savanna-dark") }
3334
}

Sources/CodeEditor/UXCodeTextViewRepresentable.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct UXCodeTextViewRepresentable : UXViewRepresentable {
109109
}
110110
textViewDidChange(textView: textView)
111111
}
112-
#elseif os(iOS)
112+
#elseif os(iOS) || os(visionOS)
113113
public func textViewDidChange(_ textView: UITextView) {
114114
textViewDidChange(textView: textView)
115115
}
@@ -139,7 +139,7 @@ struct UXCodeTextViewRepresentable : UXViewRepresentable {
139139

140140
textViewDidChangeSelection(textView: textView as! UXCodeTextView)
141141
}
142-
#elseif os(iOS)
142+
#elseif os(iOS) || os(visionOS)
143143
public func textViewDidChangeSelection(_ textView: UITextView) {
144144
textViewDidChangeSelection(textView: textView as! UXCodeTextView)
145145
}
@@ -214,7 +214,7 @@ struct UXCodeTextViewRepresentable : UXViewRepresentable {
214214
let nsrange = NSRange(range, in: textView.string)
215215
#if os(macOS)
216216
textView.setSelectedRange(nsrange)
217-
#elseif os(iOS)
217+
#elseif os(iOS) || os(visionOS)
218218
textView.selectedRange = nsrange
219219
#else
220220
#error("Unsupported OS")

0 commit comments

Comments
 (0)