Skip to content

Commit 6a7a090

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/main'
2 parents a8e3738 + 8ceb3fd commit 6a7a090

File tree

19 files changed

+982
-128
lines changed

19 files changed

+982
-128
lines changed

Example/CodeEditTextViewExample/CodeEditTextViewExample.xcodeproj/project.pbxproj

Lines changed: 408 additions & 0 deletions
Large diffs are not rendered by default.

Example/CodeEditTextViewExample/CodeEditTextViewExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/CodeEditTextViewExample/CodeEditTextViewExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"colors" : [
3+
{
4+
"idiom" : "universal"
5+
}
6+
],
7+
"info" : {
8+
"author" : "xcode",
9+
"version" : 1
10+
}
11+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"platform" : "ios",
6+
"size" : "1024x1024"
7+
},
8+
{
9+
"appearances" : [
10+
{
11+
"appearance" : "luminosity",
12+
"value" : "dark"
13+
}
14+
],
15+
"idiom" : "universal",
16+
"platform" : "ios",
17+
"size" : "1024x1024"
18+
},
19+
{
20+
"appearances" : [
21+
{
22+
"appearance" : "luminosity",
23+
"value" : "tinted"
24+
}
25+
],
26+
"idiom" : "universal",
27+
"platform" : "ios",
28+
"size" : "1024x1024"
29+
}
30+
],
31+
"info" : {
32+
"author" : "xcode",
33+
"version" : 1
34+
}
35+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.files.user-selected.read-write</key>
8+
<true/>
9+
</dict>
10+
</plist>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// CodeEditTextViewExampleApp.swift
3+
// CodeEditTextViewExample
4+
//
5+
// Created by Khan Winter on 1/9/25.
6+
//
7+
8+
import SwiftUI
9+
10+
@main
11+
struct CodeEditTextViewExampleApp: App {
12+
var body: some Scene {
13+
DocumentGroup(newDocument: CodeEditTextViewExampleDocument()) { file in
14+
ContentView(document: file.$document)
15+
}
16+
}
17+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// CodeEditTextViewExampleDocument.swift
3+
// CodeEditTextViewExample
4+
//
5+
// Created by Khan Winter on 1/9/25.
6+
//
7+
8+
import SwiftUI
9+
import UniformTypeIdentifiers
10+
11+
struct CodeEditTextViewExampleDocument: FileDocument {
12+
var text: String
13+
14+
init(text: String = "") {
15+
self.text = text
16+
}
17+
18+
static var readableContentTypes: [UTType] {
19+
[
20+
.item
21+
]
22+
}
23+
24+
init(configuration: ReadConfiguration) throws {
25+
guard let data = configuration.file.regularFileContents else {
26+
throw CocoaError(.fileReadCorruptFile)
27+
}
28+
text = String(decoding: data, as: UTF8.self)
29+
}
30+
31+
func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper {
32+
let data = Data(text.utf8)
33+
return .init(regularFileWithContents: data)
34+
}
35+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDocumentTypes</key>
6+
<array>
7+
<dict>
8+
<key>CFBundleTypeRole</key>
9+
<string>Editor</string>
10+
<key>LSItemContentTypes</key>
11+
<array>
12+
<string>com.example.plain-text</string>
13+
</array>
14+
<key>NSUbiquitousDocumentUserActivityType</key>
15+
<string>$(PRODUCT_BUNDLE_IDENTIFIER).exampledocument</string>
16+
</dict>
17+
</array>
18+
<key>UTImportedTypeDeclarations</key>
19+
<array>
20+
<dict>
21+
<key>UTTypeConformsTo</key>
22+
<array>
23+
<string>public.plain-text</string>
24+
</array>
25+
<key>UTTypeDescription</key>
26+
<string>Example Text</string>
27+
<key>UTTypeIdentifier</key>
28+
<string>com.example.plain-text</string>
29+
<key>UTTypeTagSpecification</key>
30+
<dict>
31+
<key>public.filename-extension</key>
32+
<array>
33+
<string>exampletext</string>
34+
</array>
35+
</dict>
36+
</dict>
37+
</array>
38+
</dict>
39+
</plist>

0 commit comments

Comments
 (0)