What similarities does Swift have to JS at all? There are some with Python, though not many.
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
Anyway the future isn’t Swift, it’s JavaScript for everyone :-)
Don’t dismiss visual similarities so out of hand.
Yet, many programmers love Smalltalk, which is where this "new" syntax came from.
It has made me really want to look into learning Smalltalk as a throwback hobby.