This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var body: some Scene { | |
DocumentGroup(newDocument: { | |
DocExampleDocument() | |
}) { file in | |
ContentView(document: file.document) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Published var text: String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func snapshot(contentType: UTType) throws -> String { | |
return self.text | |
} | |
func write(snapshot: String, to fileWrapper: inout FileWrapper, contentType: UTType) throws { | |
let data = snapshot.data(using: .utf8)! | |
fileWrapper = FileWrapper(regularFileWithContents: data) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DocExampleDocument: ReferenceFileDocument { | |
// ... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try? URLSession.shared.dataTask(for: endpoint) { (data, response, error) in | |
// Do something with the response… | |
} | |
// Or using Combine… | |
if #available(OSX 10.15, *) { | |
let publisher = try? URLSession.shared.dataTaskPublisher(for: endpoint) | |
// Do something with the Combine Publisher |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let endpoint = Pinball.Endpoint( | |
method: .get, | |
host: 'baconipsum.com', | |
paths: ["api"], | |
queries: [ | |
Pinball.Query(key: "type", value: "meat-and-filler") | |
] | |
) |