Skip to content

IOS Swift : Explain Higher-order Function Examples : 1. Map 2. compactMap 3. flatMap 4. filter 5. reduce 6. forEach 7. contains 8. removeAll 9. sorted 10. split

Notifications You must be signed in to change notification settings

AyaBaghdadi/higher_order_function

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Technicalisto

IOS Swift : Explain Higher-order Function Examples

1. Map
2. compactMap
3. flatMap // deprecated
4. filter
5. reduce
6. forEach
7. contains
8. removeAll
9. sorted
10. split

Short Definition

* Map
This function performs an process on all the elements and returns a new collection with the results of the proces on the original elements.
* compactMap
Function is similar to map with this difference -> the result array does not contain any nil values.
* faltMap
Is useful when there are collections inside collections But -> it’s “ Deprecated “
* Filter
It's purpose is to filter the elements of a collection based on a condition and produce a new one containing only those elements that satisfy the condition.
* Reduce
Produce one value from the values of all elements in a collection. 
* forEach
It provides a closure that implements the custom logic. 
* Contains
Check if there are elements that satisfy a certain condition and it returns a boolean value. 
* removeAll
Similar to [ contains ] when it’s necessary to remove collection elements based on conditions that regard the actual element values.
* Sorted
Data in ascending order is easy in Swift using the sorted().
* Split
Used with String values and its purpose is to split a string into pieces based on a given condition. The result is an array of substrings.

Thanks

This app is inspired by Aya Baghdadi” and copyright for @Technicalisto

About

IOS Swift : Explain Higher-order Function Examples : 1. Map 2. compactMap 3. flatMap 4. filter 5. reduce 6. forEach 7. contains 8. removeAll 9. sorted 10. split

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages