Post

Replies

Boosts

Views

Activity

Reply to How to add placeholder text to TextEditor in SwiftUI?
Here's my take on the ZStack method: ZStack(alignment: .topLeading) { TextEditor(text: $draftPreface)         .frame(height: 100)         .border(Color(uiColor: .opaqueSeparator), width: 0.5)     Text("preface").fontWeight(.light).foregroundColor(.black.opacity(0.25)).padding(8).hidden(!draftPreface.isEmpty) } I extended View with a conditional .hidden: extension View {     @ViewBuilder public func hidden(_ shouldHide: Bool) -> some View {         switch shouldHide {         case true: self.hidden()         case false: self         }     } }
Jul ’21
Reply to Why does .swipeAction set editMode?
I understand now. The Done button is useful for cancelling the swipe. swipe to reveal the hidden button(s) behind the row. decide you don't want to use those buttons. A) swipe the row back B) OR interact somewhere else C) OR tap Done to have the row return to normal. The EditMode isActive is true while the row is swiped aside, but the value is not .active.
Jul ’21
Reply to How to solve "Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates." error?
Answering my own question: Yes. when the issue occurs, go to the issues navigator, control-click any of the main-thread issues, and choose Create Breakpoint from the context menu. All main-thread issue will now break. (Xcode 9 used to have a "Pause on issues" checkbox but that is gone in Xcode 12.)
May ’21
Reply to Recommended way for testing CloudKit with two separate Apple Developer accounts?
I discussed this with developer support using up one of my 2 annual tickets. For people like me with individual developer accounts you cannot add other accounts to the team, at least not without ponying up for a second $99/year account. Instead the best option was to use a separate container for release. Just have to be sure to rebuild and test with the correct container before releasing the app :-)
May ’21
Reply to List contents of NSUbiquitousKeyValueStore
Right after posting this I thought of a crude way to do it: dive into the app's sandbox on a simulator... /Users/«USER»/Library/Developer/CoreSimulator/Devices/«DEVICE»/data/Containers/Data/Application/«APP»/Library/SyncedPreferences/«BUNDLE».plist Good enough for debugging, but having a keys property would be better. I mean, if I need to clean up disused prefs I had really better never forget which keys were used when I shipped.
Apr ’21