diff --git a/.gitmodules b/.gitmodules index 24c94b1b..82d7dbf2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,4 +4,4 @@ [submodule "packages/SpeculidKit"] path = packages/SpeculidKit url = https://github.com/brightdigit/SpeculidKit.git - branch = release/v3.0.0-alpha.1 + branch = release/3.0.0-alpha.2 diff --git a/Speculid.xcodeproj/project.pbxproj b/Speculid.xcodeproj/project.pbxproj index 98611465..d584fc0a 100644 --- a/Speculid.xcodeproj/project.pbxproj +++ b/Speculid.xcodeproj/project.pbxproj @@ -14,8 +14,6 @@ B34B6BBF24BDEF2B00F4EE6B /* CairoSVG.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B37B472124B93CB900AE2021 /* CairoSVG.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; B34B6BC224BE354D00F4EE6B /* BookmarkURLCollectionObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = B34B6BC124BE354D00F4EE6B /* BookmarkURLCollectionObject.swift */; }; B3796B7C2432C50100E5F5F9 /* speculid in CopyFiles */ = {isa = PBXBuildFile; fileRef = B3DB4824243166FC00B1DA4F /* speculid */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - B3B6A4CF24B15292009C6E32 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B364624224B14DBB0089382E /* ContentView.swift */; }; - B3B6A4D024B15292009C6E32 /* doc_appDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = B364624024B14DBB0089382E /* doc_appDocument.swift */; }; B3B6A4D124B15292009C6E32 /* doc_appApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B364623E24B14DBB0089382E /* doc_appApp.swift */; }; B3DB48142431642600B1DA4F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B3DB48132431642600B1DA4F /* Assets.xcassets */; }; B3DB48172431642600B1DA4F /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B3DB48162431642600B1DA4F /* Preview Assets.xcassets */; }; @@ -71,8 +69,6 @@ B347128A24B668DE001CCCFD /* ClassicView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClassicView.swift; sourceTree = ""; }; B34B6BC124BE354D00F4EE6B /* BookmarkURLCollectionObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkURLCollectionObject.swift; sourceTree = ""; }; B364623E24B14DBB0089382E /* doc_appApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = doc_appApp.swift; sourceTree = ""; }; - B364624024B14DBB0089382E /* doc_appDocument.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = doc_appDocument.swift; sourceTree = ""; }; - B364624224B14DBB0089382E /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ContentView.swift; path = "../doc-app/ContentView.swift"; sourceTree = ""; }; B3796B792432B7FF00E5F5F9 /* Command.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Command.entitlements; sourceTree = ""; }; B37A52372435014400FEA6E9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; B37B472124B93CB900AE2021 /* CairoSVG.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = CairoSVG.xcframework; path = packages/SpeculidKit/packages/CairoSVG/build/CairoSVG.xcframework; sourceTree = ""; }; @@ -158,8 +154,6 @@ isa = PBXGroup; children = ( B364623E24B14DBB0089382E /* doc_appApp.swift */, - B364624024B14DBB0089382E /* doc_appDocument.swift */, - B364624224B14DBB0089382E /* ContentView.swift */, B3DB480E2431642100B1DA4F /* ContentView.swift */, B3DB48132431642600B1DA4F /* Assets.xcassets */, B3DB48182431642600B1DA4F /* Main.storyboard */, @@ -282,8 +276,6 @@ B347128B24B668DE001CCCFD /* ClassicView.swift in Sources */, B347128924B64968001CCCFD /* ClassicDocument.swift in Sources */, B3B6A4D124B15292009C6E32 /* doc_appApp.swift in Sources */, - B3B6A4CF24B15292009C6E32 /* ContentView.swift in Sources */, - B3B6A4D024B15292009C6E32 /* doc_appDocument.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Speculid/BookmarkURLCollectionObject.swift b/Speculid/BookmarkURLCollectionObject.swift index 3372f343..376680c7 100644 --- a/Speculid/BookmarkURLCollectionObject.swift +++ b/Speculid/BookmarkURLCollectionObject.swift @@ -6,6 +6,19 @@ // import Foundation + +extension UserDefaults { + + @objc + var bookmarks : [String : Data]? { + get { + self.dictionary(forKey: "bookmarks") as? [String : Data] + } + set { + self.set(newValue, forKey: "bookmarks") + } + } +} public class BookmarkURLCollectionObject : ObservableObject { //@AppStorage("bookmarks", store: UserDefaults(suiteName: "MLT7M394S7.group.com.brightdigit.Speculid")) diff --git a/Speculid/ClassicView.swift b/Speculid/ClassicView.swift index 790a85f5..8a9a47a9 100644 --- a/Speculid/ClassicView.swift +++ b/Speculid/ClassicView.swift @@ -8,18 +8,6 @@ import SwiftUI import SpeculidKit -extension UserDefaults { - - @objc - var bookmarks : [String : Data]? { - get { - self.dictionary(forKey: "bookmarks") as? [String : Data] - } - set { - self.set(newValue, forKey: "bookmarks") - } - } -} @@ -30,7 +18,6 @@ struct ClassicView: View { @Binding var document: ClassicDocument @EnvironmentObject var bookmarkCollection : BookmarkURLCollectionObject @Environment(\.importFiles) var importFiles - @Environment(\.exportFiles) var exportFiles var canBuild : Bool { return url != nil && @@ -67,10 +54,6 @@ struct ClassicView: View { guard case let .success(url) = result else { return } - //let url = jsonURL.deletingLastPathComponent() - - debugPrint(url.path) - debugPrint(self.url?.deletingLastPathComponent().appendingPathComponent(self.document.document.assetDirectoryRelativePath).path) guard url.path == self.url?.deletingLastPathComponent().appendingPathComponent(self.document.document.assetDirectoryRelativePath).path else { return } @@ -136,6 +119,6 @@ struct ClassicView: View { struct ClassicView_Previews: PreviewProvider { static var previews: some View { - ClassicView(url: nil, document: .constant(ClassicDocument())) + ClassicView(url: nil, document: .constant(ClassicDocument())).environmentObject(BookmarkURLCollectionObject()) } } diff --git a/Speculid/doc_appApp.swift b/Speculid/doc_appApp.swift index be78994c..859abd00 100644 --- a/Speculid/doc_appApp.swift +++ b/Speculid/doc_appApp.swift @@ -12,10 +12,10 @@ struct doc_appApp: App { @StateObject private var bookmarkCollection = BookmarkURLCollectionObject() @SceneBuilder var body: some Scene { - - DocumentGroup(newDocument: doc_appDocument()) { file in - ContentView(document: file.$document) - } +// +// DocumentGroup(newDocument: doc_appDocument()) { file in +// ContentView(document: file.$document) +// } DocumentGroup(viewing: ClassicDocument.self) { (file) in return ClassicView(url: file.fileURL, document: file.$document).environmentObject(bookmarkCollection) diff --git a/Speculid/doc_appDocument.swift b/Speculid/doc_appDocument.swift deleted file mode 100644 index d2773afd..00000000 --- a/Speculid/doc_appDocument.swift +++ /dev/null @@ -1,48 +0,0 @@ -// -// doc_appDocument.swift -// doc-app -// -// Created by Leo Dion on 7/4/20. -// - -import SwiftUI -import UniformTypeIdentifiers - -extension UTType { - static var speculidProjectDocument: UTType { - UTType(importedAs: "com.brightdigit.speculid-project-document") - } -} - -struct doc_appDocument: FileDocument { - var text: String - - init(text: String = "Hello, world!") { - self.text = text - } - - static var readableContentTypes: [UTType] { [.speculidProjectDocument] } - - init(fileWrapper: FileWrapper, contentType: UTType) throws { - guard let data = fileWrapper.regularFileContents, - let string = String(data: data, encoding: .utf8) - else { - throw CocoaError(.fileReadCorruptFile) - } - text = string - } - - func write(to fileWrapper: inout FileWrapper, contentType: UTType) throws { - let data = text.data(using: .utf8)! - fileWrapper = FileWrapper(regularFileWithContents: data) - } - - func build () { - } -} - -struct doc_appDocument_Previews: PreviewProvider { - static var previews: some View { - /*@START_MENU_TOKEN@*/Text("Hello, World!")/*@END_MENU_TOKEN@*/ - } -} diff --git a/doc-app/ContentView.swift b/doc-app/ContentView.swift deleted file mode 100644 index 25e6e73d..00000000 --- a/doc-app/ContentView.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// ContentView.swift -// doc-app -// -// Created by Leo Dion on 7/4/20. -// - -import SwiftUI - -struct ContentView: View { - @Binding var document: doc_appDocument - - var body: some View { - HStack{ - TextEditor(text: $document.text) - Button("Build") { - document.build() - } - } - } -} - -struct ContentView_Previews: PreviewProvider { - static var previews: some View { - ContentView(document: .constant(doc_appDocument())) - } -} diff --git a/packages/SpeculidKit b/packages/SpeculidKit index 0635efb6..293a7193 160000 --- a/packages/SpeculidKit +++ b/packages/SpeculidKit @@ -1 +1 @@ -Subproject commit 0635efb677a98913320cd636e86d364bdd12e414 +Subproject commit 293a7193f2f58fbad0c6ab1de84e07020439d1e2