Blog Archives

Parameter defaults and Optional function parameters in Swift

This post has been updated for Swift 3.0 here. This post has been updated for Swift 3.0 here. Swift has an interesting multi-pronged approach to dealing with default and optional function parameters, based in part on its relationship with Objective C and

Tagged with: , ,
Posted in Swift

func parameters in Swift

STOP PRESS: Updated for Swift 2.0 here! How function parameters work in Swift can be a little confusing, here’s an attempt to make it clearer: 1. func By default parameters of funcs do not have external names: If you want

Tagged with:
Posted in Swift

Optional parameters in methods in Objective C

Methods in Objective C are actually called messages but they’re often referred to as methods, a more commonly used terminology. Optional parameters are treated in an interesting way in Objective C. Basically there are no optional parameters! In fact the

Tagged with: ,
Posted in Objective C