top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How to set return type for function in SWIFT

0 votes
110 views

How to set return type for function in SWIFT.

posted Sep 11, 2014 by Arun

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Syntax for function with return type is

fund functionName()-> return type {

return value
}

Example

func sayHello(personName: String) -> String {
    let greeting = "Hello, " + personName + "!"
    return greeting
}
answer Sep 22, 2014 by Raju
Similar Questions
0 votes

Is it possible to set multiple return type for function in SWIFT. If yes please provide me syntax .

+1 vote

How to set image for UIImageView in UITableViewCell Asynchronously for each cell.

0 votes

I am facing situation to use external parameter name to a function parameter name .. How to achieve this

+1 vote

How to declare single parameter which accept multiple values.

0 votes

how to use reusable identifier for table view cell in SWIFT.
In Objective C:

static NSString *identifier = @"mainMenuCell";
    cell =[tableView dequeueReusableCellWithIdentifier:identifier];  

Then how it should be in SWIFT

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...