Major components of Mac OS X, including the UNIX core, are made available under Apple’s Open Source license, allowing developers and students to view source code,
learn from it and submit suggestions and modifications.
NSString *str = @"hello,";
str = [str stringByAppendingString:@" world"];
var str = "hello,"
str += " world"
Objective-C
Swift
let double = 70.0
let typedDouble: Double = 70.0
var array = [1, 2, 3]
var typedArray: [String] = ["a", "b"]
// Type checking:
if m is Movie {
//...
}
class Vehicle {
var numberOfWheels = 0
var description: String {
return "\(numberOfWheels) wheel(s)"
}
func init() {
//...
}
func deinit() {
//...
}
}
func printName(optionalName: String?) {
if let name = optionalName {
print("Hello, \(name)")
} else {
print("Hello!")
}
}
printName("John Appleseed")
printName(nil)
https://swiftlang.ng.bluemix.net/