From cbf1a5fba8175a64747a7b374bac9cdd7304f43b Mon Sep 17 00:00:00 2001 From: Arasuvel Theerthapathy Date: Tue, 20 Dec 2016 17:51:32 +0530 Subject: [PATCH] Swift 3.0 syntax changes. --- ...ion-for-removing-objects-in-array-swift.md | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/ios_tips/2016-05-28-Extension-for-removing-objects-in-array-swift.md b/ios_tips/2016-05-28-Extension-for-removing-objects-in-array-swift.md index 4ce9706..46f7978 100644 --- a/ios_tips/2016-05-28-Extension-for-removing-objects-in-array-swift.md +++ b/ios_tips/2016-05-28-Extension-for-removing-objects-in-array-swift.md @@ -8,6 +8,8 @@ tip-description: In swift we don't have methods to remove the particular object, --- #### Code +**Swift2** + extension Array where Element: Equatable { // Returns the indexes of the object @@ -36,3 +38,34 @@ tip-description: In swift we don't have methods to remove the particular object, } } + +**Swift 3** + + extension Array where Element: Equatable { + + // Returns the indexes of the object + public func indexesOf(object: Element) -> [Int] { + var indexes = [Int]() + for index in 0..