Post

Replies

Boosts

Views

Activity

SwiftUI popover from the nav bar doesn't dismiss properly
A SwiftUI popover presented from a button installed in the nav bar via .toolbar(...) does not dismiss when tapped outside the popover. Instead, it jumps to the upper left corner of the screen. This started happening in Xcode 12 beta 6. I've filed a bug with Apple (FB8546290). .toolbar {     Button("Bad Popover") {         isShowingBadPopover.toggle()     }     .popover(isPresented: $isShowingBadPopover) {         Text("Tap outside and notice that the popover moves instead of being dismissed.")             .padding()             .frame(width: 320, height: 100)     } }
7
0
4.4k
Aug ’20
Conflict resolution for FileDocument?
Using the new SwiftUI support for FileDocument, is there a way to provide conflict resolution like there is for UIDocument? UIDocument provides documentState and stateChangedNotification. There is nothing defined in the FileDocument that indicates this capability. And SwiftUI does not seem to provide any automatic conflict resolution UI for your app. So when the user selects a document with conflicting versions, your app is unaware and simply opens the document for the user to edit.
1
0
870
Jul ’20
Let user pick document type to create when using SwiftUI & DocumentGroup
My document-based app supports several different file types. It is currently written in SwiftUI using a UIDocumentBrowserViewController. I'm trying to convert to the new SwiftUI (v2) DocumentGroup paradigm. I need to let the user pick which kind of document to create when they tap the Create button in the document browser. Using DocumentGroup paradigm, I don't see how this is possible. When you create a DocumentGroup, you have to specify the document right there: var body: some Scene {     DocumentGroup(newDocument: TextDocument()) { file in         TextDocumentEditor(document: file.$document)     } } When using UIKit, the browser calls a delegate function didRequestDocumentCreationWithHandler that lets the app inject some UI for picking a document type, before proceeding on. In fact, what you can do is provide the document browser with a template file to be used for creating the new doc. Is that possible in SwiftUI 2?
3
1
1.1k
Jun ’20