-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix removeAll method in sections #2141
Conversation
Source/Core/Section.swift
Outdated
} | ||
kvoWrapper.rows.removeObjects(in: removedRows) | ||
|
||
for row in removedRows { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 line of code....
x.foreach {
x.map {
Source/Core/Section.swift
Outdated
kvoWrapper.rows.removeObjects(in: removedRows) | ||
|
||
for row in removedRows { | ||
row.willBeRemovedFromSection() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
willBeRemovedFromSection , but the rows were already removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did the same as for removeAll(keepCapacity:
a710cc3
to
5841988
Compare
Source/Core/Form.swift
Outdated
|
||
public func removeAll(where shouldBeRemoved: (Section) throws -> Bool) rethrows { | ||
let indices = try kvoWrapper._allSections.enumerated().filter { (element) -> Bool in | ||
return try shouldBeRemoved(element.element) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use the short syntax .filter { try shouldBeRemoved($0.element )}
Source/Core/Form.swift
Outdated
let indices = try kvoWrapper._allSections.enumerated().filter { (element) -> Bool in | ||
return try shouldBeRemoved(element.element) | ||
}.map { $0.offset } | ||
var removedSections: [Section] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var removedSections = [Section]()
Source/Core/Section.swift
Outdated
@@ -324,6 +324,19 @@ extension Section: RangeReplaceableCollection { | |||
} | |||
} | |||
|
|||
public func removeAll(where shouldBeRemoved: (BaseRow) throws -> Bool) rethrows { | |||
let indices = try kvoWrapper._allRows.enumerated().filter { (element) -> Bool in | |||
return try shouldBeRemoved(element.element) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
→
Source/Core/Section.swift
Outdated
let indices = try kvoWrapper._allRows.enumerated().filter { (element) -> Bool in | ||
return try shouldBeRemoved(element.element) | ||
}.map { $0.offset } | ||
var removedRows: [BaseRow] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
→
😎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💪💪💪💪 groso Mathi!
this is causing me some trouble, any idea when we will see a new release? |
Just installed 5.3.3 and im stilll having this issue
|
Please open a new issue and add details for the exception you are seeing. What is the error message? It seems you are calling |
Override the
removeAll(where:)
method as it causes Duplicate Tag errorsFixes #2048