Swift
Objective C
Objective C without the C
C# with Cocoa
C# vs Swift – Arrays
●
Objective C
NSArray *myArray = [[NSArray alloc]
init];
NSArray *myArray = [[NSArray alloc]
initWith...
C# vs Swift - Functions
●
Objective C
- (string)sayHello:(string)name
{
// do something
}
●C#
st ri ng sayHello(st ri ng n...
Playgrounds
What next?
How to get it
Further Resources
●
Swift Language website.
●
Swift Programming Language: iBook or PDF
●
Using Swift with Cocoa and Object...
Upcoming SlideShare
Loading in …5
×

Swift Lunch & LEarn

493 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
493
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • The new language from Apple for iOS and MacOS development
    In closed development since 2010
    Influences: C#, Ruby, Rust, ML, ObjC
    ObjC without the C?
    Or is it C#/Java with the Cocoa framework
  • ObjC is really just C, with a thin layer over the top.
    C puts a target on your foot, and then puts your foot against your head
    It looks weird with the square brackets notation instead of dot notation in c#/Java
    It feels weird because of the messaging-passing system vs the method calling system in c#/Java
    And this is how you get Xamarin, a wildly overpriced product that saves c# devs having to learn something new.
  • Swift sets out to avoid the more notoriously destructive qualities of c
    Memory management by default
    No pointers
    Assignments don't return a value
    No fall through in switch statements, so no need for break
    Variables are always initialized
    Array bounds checked, overflows cause exceptions
    No integer overflows
    All blocks require braces
  • This is nothing new, almost all third gen c-like languages have all or most of these restrictions.
    Memory management and pointers
    So perhaps it is better to say it is Java/C# with some ObjC makeup and Cocoa binds
    For much of the core language, Swift is indistinguishable from c#
  • Playground is a visual, interactive Read-Eval-Print Loop
    Allows the developer to view the state of the variables in their code
    For loops a visual view displays the changing values of variables over time
    Visual view can also display UI elements
    http://www.youtube.com/watch?v=w87fOAG8fjk#t=6460
  • Not the dawn of some golden age of Apple development
    Still in beta. Language is still having rough edges buffed off
    Objective C won't go away overnight:
    Years of existing software
    The flipside of familiarity for C#/Java devs is unfamiliarity for ObjC developers
    Cocoa designed for Objective C
    Xamarin.iOS should lose market share
  • Requires Mac OS
    Requires XCode 6, which is still in beta
    And totes can only be acquired by fully paid up members of the iOS or Mac Developer Programs
  • Swift Lunch & LEarn

    1. 1. Swift
    2. 2. Objective C
    3. 3. Objective C without the C
    4. 4. C# with Cocoa
    5. 5. C# vs Swift – Arrays ● Objective C NSArray *myArray = [[NSArray alloc] init]; NSArray *myArray = [[NSArray alloc] initWithObjects:@"one", @"two", @"three", nil]; ●Swift var myArray = String[](); var myArray = [“one”, “two”, “three”]; ●C# var myArray = new string[]; var myArray = new []{“one”, “two”, “three”};
    6. 6. C# vs Swift - Functions ● Objective C - (string)sayHello:(string)name { // do something } ●C# st ri ng sayHello(st ri ng name) { // do something } ●Swift func sayHello(name: String) -> String { // do something }
    7. 7. Playgrounds
    8. 8. What next?
    9. 9. How to get it
    10. 10. Further Resources ● Swift Language website. ● Swift Programming Language: iBook or PDF ● Using Swift with Cocoa and Objective C: iBook or PDF ● Reddit or Medium communities ● Swift at WWDC ● Playground demo at WWDC

    ×