O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Objective-C without C
Language Design
Lambda
Optional
Type Inference Generics
Extension
Protocol
No GC (Objective-C ARC)
Hello World
String interpolation (word)
Type Inference
let word = “Swift”
Array & Dict
Use similar syntax for Array and Dictionary
The key of dictionary is non-deterministic.
Array & Dict
Array and Dictionary are copied when assigned.
Function & Lambda
{

(params) -> return type in 

statement

}
Trailing lambda. 

ajax(param1, label:{lambda})

can be wri...
Closure
Closures works like a class, which has instance variables.
var count

{ () -> () in

return count++

}
Optional
String? = Optional<String>
You cannot assign nil to variables. Use Optional type if it could be nil.
if let unwra...
Class
Protocol
Protocol is interface
Generics
func printFullname<T: Fullname>(person: T) {
func printFullname(person: Fullname) {
Extension
You can append methods to the existing classes like Ruby Monkey patch.
Próximos SlideShares
Carregando em…5
×

Swift

Swift, beginner

  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

Swift

  1. 1. Objective-C without C
  2. 2. Language Design Lambda Optional Type Inference Generics Extension Protocol No GC (Objective-C ARC)
  3. 3. Hello World String interpolation (word) Type Inference let word = “Swift”
  4. 4. Array & Dict Use similar syntax for Array and Dictionary The key of dictionary is non-deterministic.
  5. 5. Array & Dict Array and Dictionary are copied when assigned.
  6. 6. Function & Lambda { (params) -> return type in statement } Trailing lambda. ajax(param1, label:{lambda}) can be written as ajax(param1) {lambda}
  7. 7. Closure Closures works like a class, which has instance variables. var count { () -> () in return count++ }
  8. 8. Optional String? = Optional<String> You cannot assign nil to variables. Use Optional type if it could be nil. if let unwraps the optional. Returns true if it is not nil.
  9. 9. Class
  10. 10. Protocol Protocol is interface
  11. 11. Generics func printFullname<T: Fullname>(person: T) { func printFullname(person: Fullname) {
  12. 12. Extension You can append methods to the existing classes like Ruby Monkey patch.

×