Swift for c#Shops

But...Objective C? 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] initWithObjects:@"one", @"two", @"three", nil];

C#

var myArray = new string[];
var myArray = new []{“one”, “two”, “three”}

Swift


var myArray = String[]()
var myArray = [“one”, “two”, “three”]    

C# vs Swift – Functions

Objective C

- (string)sayHello:(string)name
{
 // do something
}

c#

string sayHello(string name) {
    // do something
}

Swift

func sayHello(name: String) -> String {
    // do something
}

Playgrounds


What next?


How to get it


Further Resources

Swift Language website .

Swift Programming Language: iBook  or PDF

Using Swift with Cocoa and Objective C:  iBook or PDF

Reddit and Medium communities

Swift at WWDC


Swift for C# Shops

By David Edgar

Swift for C# Shops

  • 645
Loading comments...