I can slice any array in pieces, then process one chunk at a time with the SequenceType.…
Generic Array of Int - what, why, how?
One of the great feature introduced by Swift 2.0 is possibility to define generic functions for type of Array. Array is container for values of some type. The type is known upfront. It's called Element now. what? Array is a struct with element and is defined like…
Fast pattern search in Swift... since 1974
Boyer-Moore algorithm. At the beginning brief introduction, later on Swift implementation, tests and conclusion.…
Collection Index and magic factor
> An index is an indirect shortcut derived from and pointing into, a greater volume of values, data, information or knowledge. (wikipedia) In general (however it is not the rule) in modern programming languages Index values start at 0 position and ends at "length - 1" position. A lot…
Practical Swift: pages generator - build once, use many
In the real world, at some point, we all have to deal with data that is fetched from a backend service, page by page. It's called paging. Everybody does this! Nothing to be ashamed of ;-) Here is one of the ways in which a Swift pattern (well, not…