Add array removal helper
This commit is contained in:
parent
22e7d9a05a
commit
0dca633805
@ -211,6 +211,7 @@
|
||||
E2FE0F192D2723E3002963B7 /* ImageSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FE0F182D2723E3002963B7 /* ImageSet.swift */; };
|
||||
E2FE0F1B2D274FDF002963B7 /* LinkPreviewItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FE0F1A2D274FDA002963B7 /* LinkPreviewItem.swift */; };
|
||||
E2FE0F1E2D281AE1002963B7 /* TagOverviewGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FE0F1D2D281ACE002963B7 /* TagOverviewGenerator.swift */; };
|
||||
E2FE0F202D29A70E002963B7 /* Array+Remove.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FE0F1F2D29A709002963B7 /* Array+Remove.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -413,6 +414,7 @@
|
||||
E2FE0F182D2723E3002963B7 /* ImageSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageSet.swift; sourceTree = "<group>"; };
|
||||
E2FE0F1A2D274FDA002963B7 /* LinkPreviewItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkPreviewItem.swift; sourceTree = "<group>"; };
|
||||
E2FE0F1D2D281ACE002963B7 /* TagOverviewGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagOverviewGenerator.swift; sourceTree = "<group>"; };
|
||||
E2FE0F1F2D29A709002963B7 /* Array+Remove.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+Remove.swift"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -778,6 +780,7 @@
|
||||
E2B85F552C4BD0AD0047CD0C /* Extensions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E2FE0F1F2D29A709002963B7 /* Array+Remove.swift */,
|
||||
E2FE0EE72D16D4A3002963B7 /* ConvertThrowing.swift */,
|
||||
E25DA5182CFF035200AEF16D /* Array+Split.swift */,
|
||||
E2B85F562C4BD0BB0047CD0C /* Binding+Extension.swift */,
|
||||
@ -955,6 +958,7 @@
|
||||
E2FE0EFE2D266DA5002963B7 /* NavigationSettingsFile.swift in Sources */,
|
||||
E2FE0EE62D15A0B5002963B7 /* GenerationResults.swift in Sources */,
|
||||
E2FE0F152D26918F002963B7 /* PageHtmlProcessor.swift in Sources */,
|
||||
E2FE0F202D29A70E002963B7 /* Array+Remove.swift in Sources */,
|
||||
E25DA5772D018B9900AEF16D /* File+Mock.swift in Sources */,
|
||||
E25DA5892D01CBD300AEF16D /* Content+Generation.swift in Sources */,
|
||||
E229904C2D10BE5D009F8D77 /* InitialSetupView.swift in Sources */,
|
||||
|
12
CHDataManagement/Extensions/Array+Remove.swift
Normal file
12
CHDataManagement/Extensions/Array+Remove.swift
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
extension Array where Element: Equatable {
|
||||
|
||||
@discardableResult
|
||||
mutating func remove(_ element: Element) -> Bool {
|
||||
guard let index = firstIndex(of: element) else {
|
||||
return false
|
||||
}
|
||||
remove(at: index)
|
||||
return true
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user