Your Second iOS and SwiftUI App · Deleting from Lists | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5662524-your-second-ios-and-swiftui-app/lessons/14

As of now, the remove(atOffsets:) method seems to be replaced by remove(at: Int). How do I solve the problem?

Those are different overloads.

https://developer.apple.com/documentation/swift/rangereplaceablecollection/3349502-remove

https://developer.apple.com/documentation/swift/rangereplaceablecollection/3018268-remove

Thanks for the quick reply. I could find both in the Apple Developers Documentation, but most importantly remove(atOffsets:) won’t appear at the autocomplete section. If I type it down, this error message Incorrect argument label in call (have 'atOffsets:', expected 'at:') appears. Also, in the Array section of the documentation, I searched for the remove method, only to find the latter one(at:).

I’ve never gotten autocomplete for it either, but it’s been compiling since a late beta of Xcode 11. Can you not get the End project to compile?

I just tried and it compiled. I got back to my project and somehow it started to compile well. Xcode might have been acting up :sweat_smile: Btw, is it a xcode bug that it’s not giving an autocompletion for remove(atOffsets:)?

1 Like

Yes, and it’s still present in the Xcode 11.4 beta that came out today. :slightly_frowning_face:

Please log it if you find yourself with the time to do so. https://feedbackassistant.apple.com

If your simulator does not respond to swipe to delete, try restart it, that resolved my issue

@shp7724 Do you still have issues with this?

@kychris Thank you for sharing this - much appreciated!

Hi, I also had the doesn’t delete when swiped problem. Restarting the simulator didn’t work out. Turned out that somehow I had managed to not actually put @ObservedObject in the

@ObservedObject var taskStore:TaskStore

line in ContentView. Whoops. Hopes this helps save someone else a little time.

@carlyn Thank you for sharing your solution - much appreciated!

Hi,

I have finished the “Observable Objects” video and I have encountered on a problem.
When I want to add a new task and I am hitting the plus button nothing happens.
A workaround for that is swiping up and down the task list. After that the plus button works but only once. Every time I want to add a new entry I have to do that workaround.

Anyone had such problem?

Update:

I have found a workaround on the stackoverflow:

It looks like a bug in the SwiftUI.

@dann Thank you for sharing this - much appreciated!