Presentation is loading. Please wait.

Presentation is loading. Please wait.

Handybook: Swift Jayant Sani. Handybook Opinions “It’s like Ruby on Rails, for iOS!” – Nikita “A function should only do one thing and return.

Similar presentations


Presentation on theme: "Handybook: Swift Jayant Sani. Handybook Opinions “It’s like Ruby on Rails, for iOS!” – Nikita “A function should only do one thing and return."— Presentation transcript:

1 Handybook: Swift Jayant Sani

2

3

4

5

6 Handybook Opinions “It’s like Ruby on Rails, for iOS!” – Nikita “A function should only do one thing and return one value” - Justin

7 Brief History 1983: Objective-C is created 2000: Chris Lattner starts to work on LLVM, a compiler for Objective-C during college 2007: LLVM project releases Clang 2010: Lattner begins working on Swift 2012: Apple ditches GCC, giving LLVM more flexibility 2014: Apple announces Swift at WWDC

8 High-Level Overview Objective-C showing age – Smalltalk syntax o Around since the 1980s Many modifications to make it modern Compile time vs Runtime (Static and dynamic)

9 Modern Language Features No semicolons! Static type system Optional types Functional Programming Closures Tuples Generics Automatic Reference Counting Extensions REPL (Playgrounds) Designated and Convenience Initializers*

10 Static Type System Objective-C: Dynamic Typing, only object type was (id) in early stages Valid Objective-C code: NSString *string = @”Handybook”; id str = string NSDictionary *dict= str; dict[@”name”] -Compiles fine, runtime error Swift: Static Typing

11 Guess what returns

12 Functional Objective-C: Blocks F*ckingblocksyntax.com returnType (^blockName)(parameterTypes) = ^returnType(parameters) { statements }; Swift: Functions are first class objects, Closures (param1Type, param2Type, …) -> returnType { (params) -> returnType in statements }

13 GenericsExtensions Tuples

14 Drawbacks Xcode 6 is very, very, very buggy – beta Proprietary Operator overloading – controversial No pointers – errors, functions Dealing with JSON Data Message passing vs. vtable Vague constants – “let” keyword No access modifiers Objective-C without Smalltalk


Download ppt "Handybook: Swift Jayant Sani. Handybook Opinions “It’s like Ruby on Rails, for iOS!” – Nikita “A function should only do one thing and return."

Similar presentations


Ads by Google