Apple Announces New Programming Language Called Swift

DEAD7

Veteran
Supporter
Joined
Oct 5, 2012
Messages
51,477
Reputation
4,659
Daps
89,776
Reppin
Fresno, CA.
"At WWDC 2014 today, Apple announced Swift, a new programming language. According to a report by Ars Technica: 'Swift seems to get rid of Objective C's reliance on defined pointers; instead, the compiler infers the variable type, just as many scripting languages do. ... The new language will rely on the automatic reference counting that Apple introduced to replace its garbage-collected version of Objective C. It will also be able to leverage the compiler technologies developed in LLVM for current development, such as autovectorization. ... Apple showed off a couple of cases where implementing the same algorithm in Swift provided a speedup of about 1.3X compared to the same code implemented in Objective C.'"
 

Data-Hawk

I have no strings on me.
Joined
May 6, 2012
Messages
8,423
Reputation
1,995
Daps
16,333
Reppin
Oasis
:russ:so now you can almost do in c-objective what you already can in python, ruby, etc.


Python/Ruby is slow as hell for just about any type of applications though ( since they are interpreted ). Swift will be a systems programming language w/ syntax like a scripting language.

Thank God because objective-c syntax is terrible. Could never really get used to it.

Swift documentation :

The Swift Programming Language: About Swift
 
Last edited:

Data-Hawk

I have no strings on me.
Joined
May 6, 2012
Messages
8,423
Reputation
1,995
Daps
16,333
Reppin
Oasis
ahh, Guess I'll have to get used to this also..


Code:
class Vehicle {
    var numberOfWheels: Int
    var maxPassengers: Int
    func description() -> String {
        return "\(numberOfWheels) wheels; up to \(maxPassengers) passengers"
    }
    init() {
        numberOfWheels = 0
        maxPassengers = 1
    }
}

Not sure whats the point of having var numberOfWheels: int when you can just have var numberOfWheels( and determine the type at runtime ) or have ( int numberOfWheels; ) . Its not exactly cleaner syntax but I guess it'll help with speed since you know the type before running....:manny: ... Guess I'll have to read up on the benefits.



Edit: opps my bad, you can do it with var variablename

Code:
let maximumNumberOfLoginAttempts = 10
var currentLoginAttempt = 0



Ahh actually this language is starting to grow on me already. It's extremely easy to pick up and if it can maintain speed close to or better than Objective-C....:ohlawd:
 
Last edited:

Spatial Paradox

All Star
Supporter
Joined
May 16, 2012
Messages
2,345
Reputation
1,150
Daps
12,326
Reppin
Brooklyn
ahh, Guess I'll have to get used to this also..


Code:
class Vehicle {
    var numberOfWheels: Int
    var maxPassengers: Int
    func description() -> String {
        return "\(numberOfWheels) wheels; up to \(maxPassengers) passengers"
    }
    init() {
        numberOfWheels = 0
        maxPassengers = 1
    }
}

Not sure whats the point of having var numberOfWheels: int when you can just have var numberOfWheels( and determine the type at runtime ) or have ( int numberOfWheels; ) . Its not exactly cleaner syntax but I guess it'll help with speed since you know the type before running....:manny: ... Guess I'll have to read up on the benefits.

I'd say it's a nice hint to whoever's reading the code (including yourself if you ever come back to it and don't realize they're initialized in the init() function). Though the names of those variables suggest an Int...

Some of the syntax reminds me of Scala... :patrice:

Ahh actually this language is starting to grow on me already. It's extremely easy to pick up and if it can maintain speed close to or better than Objective-C....:ohlawd:

If what they claimed during the keynote is true, it is faster than Objective-C already, at least for the algorithms they showed off during the keynote. I'd love to know more about why that is, but I suspect Swift being more statically typed has something to do with it

I need to stop slacking and re-up my iOS developer membership already
 

unit321

Hong Kong Phooey
Joined
May 2, 2012
Messages
22,213
Reputation
1,722
Daps
23,107
Reppin
USA
"At WWDC 2014 today, Apple announced Swift, a new programming language. According to a report by Ars Technica: 'Swift seems to get rid of Objective C's reliance on defined pointers; instead, the compiler infers the variable type, just as many scripting languages do. ... The new language will rely on the automatic reference counting that Apple introduced to replace its garbage-collected version of Objective C. It will also be able to leverage the compiler technologies developed in LLVM for current development, such as autovectorization. ... Apple showed off a couple of cases where implementing the same algorithm in Swift provided a speedup of about 1.3X compared to the same code implemented in Objective C.'"
That's nice. I don't program on mac OS so it doesn't apply to me.
 
Top