You can declare method like below:
func test(_ myNumber: Int? = 2) {
}
In above function, I have provided a default value as 2.
I can call the function as
test()
or
test(5)
solved uiview as optional parameters in swift
You can declare method like below:
func test(_ myNumber: Int? = 2) {
}
In above function, I have provided a default value as 2.
I can call the function as
test()
or
test(5)
solved uiview as optional parameters in swift