Post

Replies

Boosts

Views

Activity

Reply to TextField in SwiftUI and Keyboard Management
Take a look at .ignoresSafeArea(...), which is new in Xcode 12 beta 4. The first parameter allows you to specify whether or not to include the keyboard in the safe area. Being able to treat the keyboard like a safe area seems to be a good route to go. I find the documentation to be a little confusing, but in my use case, .ignoresSafeArea(.container) allows my view hierarchy to avoid the keyboard. I’m not including keyboard in that first parameter, meaning the keyboard IS considered a safe area and hence my layout avoids it.
Aug ’20
Reply to Let user pick document type to create when using SwiftUI & DocumentGroup
beckersoft - https://developer.apple.com/forums/profile/beckersoft, that’s an interesting approach. I thought of trying something like that, but my app supports different file types (different file extensions) and by the time the editor gets invoked, the OS has already generated a file at the location the user chose. The app had to choose what kind of file to create as part of initializing the DocumentGroup. If the user then chooses a different file type in the template picker, I don’t think it’s easy to convert the file that was already created. It feels like I’m really working against the system and that may come back to bite me. It also seems that if you cancel out of the template picker, there’s already a document created that you’d really want to be deleted.
Jun ’20
Reply to How to distinguish between adding and viewing in one DocumentGroup Scene?
I have a similar question (https://developer.apple.com/forums/thread/651667). In regard to the nav bar, you can simply attach navigationBarItems to the content view. I would recommend you do this inside the content view itself, not as I've shown here in the App file. struct testApp: App {     var body: some Scene {         DocumentGroup(newDocument: testDocument()) { file in             ContentView(document: file.$document)                 .navigationBarItems(trailing: Button("Button", action: { print("button tapped") }))         }     } }
Jun ’20