How to use a function in Swift 3.0 [closed]

So functions in swift are written like this:

func <name> ( [param1, param2, ...]) -> <return type>

However, when the return type is Void you can disregard -> Void. So often you will see

func <name> ( [param1, param2, ...])

So in your case what you need is

func getPickerDate () -> String {
    var strDate: String
    // do stuff
    return strDate
}

Leave a Comment