from https://www.tutorialspoint.com (high seo, I do not personally endorse)
Objective-C:
- (return_type) method_name:( argumentType1 )argumentName1
joiningArgument2:( argumentType2 )argumentName2 ...
joiningArgumentn:( argumentTypen )argumentNamen
{
body of the function
}
Swift: func funcname(Parameters) -> returntype {
Statement1
Statement2
---
Statement N
return parameters
}
Javascript: function functionname(parameter-list)
{
statements
}
I know people downvoted op, but when I first learned it, reading Objective-C made me angry. The second two examples are much closer in syntax and style and require much less context switching.And it wasn't mentioned, but the if let myVar = optionalVar { ... } is a godsend for writing maintainable, crash-free code.
If you want to get a good idea of what good swift looks like, check out https://github.com/raywenderlich/swift-style-guide