Post

Replies

Boosts

Views

Activity

Reply to SwiftUI TextField clearbutton how?
struct MPTextField: View {       let title: String   @Binding var text: String   @State private var isEditing: Bool = false   private var isClear: Bool {     return self.isEditing && !self.text.isEmpty   }       init(_ title: String, text: Binding<String>) {     self.title = title     self._text = text   }       var body: some View {     ZStack(alignment: .trailing) {       TextField(self.title,            text: self.$text) { isEditing in         self.isEditing = isEditing       } onCommit: {         self.isEditing = false       }       .padding(.trailing, self.isClear ? 18 : 0)               if self.isClear {         Button {           self.text = ""         } label: {           Image(systemName: "multiply.circle.fill").foregroundColor(.secondary)         }         .buttonStyle(PlainButtonStyle())       }     }     .frame(alignment: .trailing)   } }
Jul ’21
Reply to iOS 16.0 beta 7 broke Text(Date(), style: .timer) in SwiftUI widgets
I'm tired of how many years this bug lasts. .timer had a long time alignment bug in widgets and had to use "multilineTextAlignment". We hoped this could be fixed in this update, but rather added a bigger bug. Developers modifying this module don't seem to be testing on widgets. It's time for the official version to be released soon, and I'm worried that it will be released without fixing any bugs.
Aug ’22
Reply to Multiplatform development questions
I agree with most of what szymczyk answered above. Here are a few little tips I've learned while building a multi-platform app for several months. If you used UIKit functions, you need to customize them for AppKit. (UIImage, UIApplication, UIColor) Since fullScreenCover is not supported on macOS, it is best to use sheet if possible. When using lists on macOS, it looks better to use .formStyle(.grouped). Depending on the version of macOS, if there is a problem with the list in the Form not scrolling, it must be wrapped in a ScrollView. No problem in the latest version You need to create a routine that corresponds to iOS' swipe action. You will need to modify routines related to keyboard input. (keyboardType, keyDown) If you have already created a UI for iPad landscape mode, I think you will be able to easily create an app for macOS. Even if the UI is created with the same code, testing must be done separately. In particular, there were many small bugs in NavigationSplitView on the iPad, and Apple has neglected them for a long time.
Sep ’23