Post

Replies

Boosts

Views

Activity

Reply to List with EditButton for selection, delete, and move
I think so, but I'm not sure exactly what you're trying to do. Here, I copied the code from the documentation for EditButton, and added some ability to select by tapping the text. (Probably you want to render the selection in a different way, not just green text, but I did that for simplicity.) struct ContentView: View {     @State private var fruits = [         "Apple",         "Banana",         "Papaya",         "Mango"     ]     @State private var selected = Set<String>()     var body: some View {         NavigationView{             List {                 ForEach(fruits, id: \.self) { fruit in                     Text(fruit)                         .foregroundColor( selected.contains(fruit) ? Color.green : nil )                         .onTapGesture { toggleSelected(fruit) }                 }                 .onDelete { self.deleteFruit(at :$0) }                 .onMove { self.moveFruit(from: $0, to: $1) }             }             .navigationTitle("Fruits")             .toolbar { EditButton() }         }     }     func toggleSelected(_ fruit: String) {         if selected.contains(fruit) { selected.remove(fruit) }         else { selected.insert(fruit) }     }     func deleteFruit(at: IndexSet) { fruits.remove(atOffsets: at) }     func moveFruit(from: IndexSet, to: Int) { fruits.move(fromOffsets: from, toOffset: to) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Reply to UIScrollView does not give touches to subview if drag starts quickly
My problem was caused by something dumb that I left out of my question, because I was trying to simplify it to post here. My UIScrollView was actually inside a SwiftUI view hierarchy, using UIViewRepresentable. Higher in that view hierarchy, there was a SwiftUI List, which also has scrolling. I had forgotten about that List because I was using it for it's layout appearance, grouping items into sections, but not for its scrolling. Once I got rid of that List, everything worked as expected.
Topic: UI Frameworks SubTopic: UIKit Tags:
Feb ’22
Reply to linker failing for unit tests in multiplatform project
If it's the same problem I had, it's this: with multiplatform projects, those tests that Xcode creates for you are not unit tests, but "UI Tests". They do not link the same. You need to create more targets if you want to do unit testing. You'll see the Unit Test Bundle choice when you create a new target. I gave mine a similar name to the project template's UI Tests. So now I have "Tests macOS" and "Unit Tests macOS". The first is the UI Test bundle target created by Xcode. The second is my unit testing bundle. Linking works normally in there. .
Jun ’22
Reply to Side by side Picker wheels failing in iOS 15
Here's a simulator screenshot (iPhone SE). I've marked about where the border is, for the touch events. In my real app, with wider text, it's even further to the right, so that touching the first column of text actually spins the second picker.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’21
Reply to UIDocument no longer saving, error in URLByAppendingPathExtension
Due to some problem with git, I'd lost the Info.plist definitions of the "Document Types" and "Exported Type Identifiers". Once I added those back, this error disappeared.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Are Button actions on the MainActor?
But the passed-in closure is meant to run on the main actor, and it is, it's just that the complier doesn't seem to understand that.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Swift package setup for a metal renderer
I wonder if there are any updates for this for swift-tools-version:5.5 (October 2021). I'd like to put metal shaders in a Swift package.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Debugging on iOS 15 is terribly slow in Xcode
My app starts fine, but if I stop on a breakpoint, the first load of the left panel (variables) takes a long time - about 10 seconds on a new MBPro. Once it's loaded things seem okay. Well I have other issues, like variables that I can't see or print, but that's not a speed issue.
Replies
Boosts
Views
Activity
Oct ’21
Reply to Animating popover size changes
Did you ever find an answer? I have the same question. I have a popover that changes width and height and I'd like them to animate.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to List with EditButton for selection, delete, and move
I think so, but I'm not sure exactly what you're trying to do. Here, I copied the code from the documentation for EditButton, and added some ability to select by tapping the text. (Probably you want to render the selection in a different way, not just green text, but I did that for simplicity.) struct ContentView: View {     @State private var fruits = [         "Apple",         "Banana",         "Papaya",         "Mango"     ]     @State private var selected = Set<String>()     var body: some View {         NavigationView{             List {                 ForEach(fruits, id: \.self) { fruit in                     Text(fruit)                         .foregroundColor( selected.contains(fruit) ? Color.green : nil )                         .onTapGesture { toggleSelected(fruit) }                 }                 .onDelete { self.deleteFruit(at :$0) }                 .onMove { self.moveFruit(from: $0, to: $1) }             }             .navigationTitle("Fruits")             .toolbar { EditButton() }         }     }     func toggleSelected(_ fruit: String) {         if selected.contains(fruit) { selected.remove(fruit) }         else { selected.insert(fruit) }     }     func deleteFruit(at: IndexSet) { fruits.remove(atOffsets: at) }     func moveFruit(from: IndexSet, to: Int) { fruits.move(fromOffsets: from, toOffset: to) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to App reviews show up on App Store product page but not in App Store Connect
I have the opposite situation - I see a review in the "Connect" app on my iPad, but not in the App Store. I'm don't know why.
Replies
Boosts
Views
Activity
Nov ’21
Reply to ProgressBar with DispatchQueue
When I do "New" > "Playground..." in Xcode 13, I have a choice between iOS and macOS. I'm not sure how to change it after the fact, but maybe you need to make a new Playground and choose macOS?
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to Combining chars do not render right in some fonts
I submitted feedback with example project: FB9892547.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to Disable Scrolling of a ScrollView in swiftui
Yeah, I need this too. I need to decide whether the ScrollView or the contained view should handle a drag event. It was possible in UIKit with the touchesShouldCancel method.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to UIScrollView does not give touches to subview if drag starts quickly
My problem was caused by something dumb that I left out of my question, because I was trying to simplify it to post here. My UIScrollView was actually inside a SwiftUI view hierarchy, using UIViewRepresentable. Higher in that view hierarchy, there was a SwiftUI List, which also has scrolling. I had forgotten about that List because I was using it for it's layout appearance, grouping items into sections, but not for its scrolling. Once I got rid of that List, everything worked as expected.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to linker failing for unit tests in multiplatform project
Any progress on this? I'm having similar problems. I have a local Swift package. It links fine with the app, and the app runs. But when I try to run the macOS tests I get linker errors that it doesn't see symbols from that package. Something is screwed up with multiplatform projects. (Xcode 13.4.1)
Replies
Boosts
Views
Activity
Jun ’22
Reply to linker failing for unit tests in multiplatform project
If it's the same problem I had, it's this: with multiplatform projects, those tests that Xcode creates for you are not unit tests, but "UI Tests". They do not link the same. You need to create more targets if you want to do unit testing. You'll see the Unit Test Bundle choice when you create a new target. I gave mine a similar name to the project template's UI Tests. So now I have "Tests macOS" and "Unit Tests macOS". The first is the UI Test bundle target created by Xcode. The second is my unit testing bundle. Linking works normally in there. .
Replies
Boosts
Views
Activity
Jun ’22
Reply to SwiftUI Table - Double Click Row While Retaining Single Click Selection Behavior
Same problem here and just started searching for answer. Did you find anything? I'll post an answer here if I do.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’22