Swift, as a highly protocol-oriented programming language, is chock-a-block with a multitude of protocols in its standard library. In this series, I hope to discover & learn more about some of them.
One of the most powerful parts of Swift is its support for Generics. Using Generics, you can write code that is type-agnostic, meaning less code duplication.
A protocol in Swift is generic when it does not enforce types in (some or all of) its variables and functions, on types that conform to it. Different conforming types can then implement the protocol in ways that’re relevant or convenient for them.
The MapKit framework allows you to create and embed maps in your app. But sometimes, embedding an entire map may be overkill — like if you want display multiple coordinates, as a list of maps in a UITableView. Or if you want the map to be non-interactive.
When designing the models and data structure for your app, you would probably be deciding between Structs and Classes.
If you’re coming from a different programming language, it’s easy to settle into a pattern of using…
dispatch_group is a part of Apple’s Grand Central Dispatch (GCD) set of APIs that allows you to coalesce and synchronise the results of multiple asynchronous functions into a single point of execution.
By default, Swift Playgrounds do not execute (asynchronous) code that depends on the RunLoop for callbacks or completion.
This includes, for example , NSURLConnection/Session requests, and NSTimer actions.