Post

Replies

Boosts

Views

Activity

fileImporter isPresented not updated on swipe down
On iPadOS 15 the attribute isPresented is not updated, when the user swipes down the file open dialog. From there on the dialog window does not show anymore until app restart, even if the showFileImporter variable is set to false and true again.  .fileImporter(isPresented: Binding( get: {showFileImporter}, set: {active in showFileImporter = active; logger.debug("File import active=\(active)")}), allowedContentTypes: fileImportTypes, allowsMultipleSelection: fileImportMultipleFiles, onCompletion: { args in afterFileImportSelection(args) }) I assume this is a bug. Is there ev. a Notification, which is triggered on swipe-down?
1
0
731
Oct ’21
Limit width of wheel style picker on iOS
Hello, I try to limit the width of a wheel style picker on iOS 15 using Xcode 13 beta5 in the code below. The drawing is correct, but the scroll areas of the elements overlap. So the toggle does not work and the the scrolling on the digits works with offset only. I have discovered this issue also on iOS 14. Any idea how to fix this? Matthias import SwiftUI struct ToggleButton: View {     var key: String     var systemImage: String?     @Binding var isSelected: Bool          var body: some View {         Toggle(isOn: $isSelected, label: {             if systemImage != nil {                 Label(key, systemImage: systemImage!)             } else {                 Text(key)             }         }).toggleStyle(.button)     } } struct DecimalPickerDigit: View {     var pos: Int     var height: CGFloat     var value: Int     var updateModel: (Int, Int)->Void          var body: some View {         Picker("", selection: Binding( get: { value },                                        set: { val in updateModel(val, pos) })         ) {             ForEach(0 ..< 10, id: \.self) { i in                 Text("\(i)")             }         }         .pickerStyle(.wheel)         .labelsHidden()         .frame(width: 20)         .frame(idealHeight: height, maxHeight: .infinity)         .clipped()     } } struct ContentView: View {     @State var isOn = false     @State var intVal1 = 0     @State var intVal2 = 0          var body: some View {         HStack {             ToggleButton(key: "Toggle", isSelected: $isOn)             DecimalPickerDigit(pos: 1, height: 100, value: intVal1, updateModel: { val, pos in intVal1 = val })             DecimalPickerDigit(pos: 1, height: 100, value: intVal2, updateModel: { val, pos in intVal2 = val })         }     } }
16
2
11k
Aug ’21