In a fast function, a function may have optional parameters that have default values, such as:
func f(a:Int, b:Int?=nil) {} f(1); f(1,2);
I would like to do this with related enumerated values. After this message about enter safe URL routes , I would like to have a route that can take an optional parameter, for example:
enum StopPoint { case Search(query:String, limit:Int?=nil) }
However, he says that I cannot have a default value for the parameter in the tuple. However, it is possible to have a case such as case Arrivals(stopId:Int) , but in the general case it is impossible to have a tuple with one named parameter.
So, is it possible to have an enumeration with a default parameter, and is the bound value a tuple or not?
enums swift
Jonathan.
source share