Don’t need to check hundred times, don’t need NSParameterAssert in most cases.
There is another a very popular use case about check result, here is a example in Alamofire/Result.swift
Default Prameter Values
Function definition will be much more graceful.
Functions with Multiple Return Values (Tuples)
Function Types as Parameter Types
All of the codes below do the same thing:
Could be better:
- WWDC 2015 - Session 408 - Protocol-Oriented
Programming in Swift
the Swift runtime calls the presentError() through static dispatch instead of through dynamic dispatch.
Some code snippets
Use Playground to test something when coding.