Jump to content

Apple's Swift is a new programming language with a focus on speed and ease of use


Rui Carlos
 Share

Recommended Posts

Apple's used Objective-C as its programming language of choice for right around twenty years now, but it's brought something new to its yearly developer conference: Swift, a new language of its own making. Apple' describes its new lingua franca as "Objective-C without the C," but it keeps (and improves on) the speed of its progenitors. In other words, apps built in Swift should run even smoother and faster than counterparts built with the tried and true Objective-C. According to Cupertino, Swift can be used to craft anything from social networking apps to 3D games.

Fonte: http://www.engadget.com/2014/06/02/apple-swift-programming-language/

E aqui está mais uma linguagem de programação... Estive a ver por alto o manual que a Apple já disponibilizou, e pareceu-me que será uma linguagem bem mais fácil de aprender do Objective-C para o programador comum, na medida em que parece mais próxima do C.

O manual pode ser encontrado aqui: https://itunes.apple.com/us/book/swift-programming-language/id881256329

Link to comment
Share on other sites

Por acaso está mais longe do C. Pode ser utilizada com Objective-C e C, aparentemente. Ainda estou para ver como, visto que ainda estou a dar os primeiros toques com Swift.

Para já vejo conceitos de Javascript e Python, mas ainda só estou nas primeiras 100 páginas do livro. Também se nota algum paradigma funcional.

EDIT: Já agora, ainda não vi como é feita a compilação, mas é possível que se possa compilar em Linux e Windows, tal como o Objective-C (estou a assumir alguma coisa, visto que não sei ainda como é que é feita a integração com o LLVM).

Edited by KTachyon

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Link to comment
Share on other sites

Já dei a volta ao livro. Existem muitos conceitos de Objective-C na linguagem, mas disfarçados por outra sintaxe. Existem algumas coisas que estão verdadeiramente bem disfarçadas. Basicamente, nenhum tipo primitivo é um tipo primitivo. São tudo objectos. E, tal como no Objective-C, é possível estender a funcionalidade. Isto faz com que seja possível fazer coisas do género:

extension Int {
   func repetitions(task: () -> ()) {
       for i in 0..self {
           task()
       }
   }
}


3.repetitions({println("Hello!")})

Já agora, não há Garbage Collection. É tudo ARC, o que implica fazer a gestão de retain cycles, como sempre.

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.