1. Start Terminal.app
2. Type $ swift
Using var
var count :Int = 15
count++ //this is Ok
for i in 0..<11 {
//i gets the values from 0 to 10, inclusive
}
while loop
while condition {
//run code
}
Swift Data Structures
Swift Data Structures
Swift has built-in arrays and dictionaries
let creates immutable dictionary/array
var creates mutable dictionary/array
Immutable arrays:
let numbers: [Int] = [1, 2, 3, 4, 5]
numbers[2] = -1 //compile error
numbers.append(6) //compile error
Mutable arrays:
var names: [String] = ["Doncho", "Ivaylo"]
names.append("Nikolay") //Doncho, Ivaylo, Nikolay
names.append("Pesho") //Doncho, Ivaylo, Nikolay, Pesho
names[3] = "Evlogi" //Doncho, Ivaylo, Nikolay, Evlogi
UIView.animateWithDuration( 1.0
animations: {
let frame = CGRectMake(x + 100,
y + 100,
w,
h)
view.frame = frame
});
UIKit Animations:
Animation Blocks
UIKit Animations with Animation Blocks
UIView.animateWithDuration( 1.0
delay: 1.0
options: UIViewAnimationOptions.CurveEaseIn
animations: {
let frame = CGRectMake(x + 100,
y + 100,
w,
h)
view.frame = frame
},
completion: {
view.alpha = 0.5
});
UIKit Animations
Live Demo
iOS Apps with Swift
http://academy.telerik.com
ASP.NET MVC HTML, SQL, C#, .NET, ASP.NET MVC
SEO - ,
, iPhone, Android, WP7, PhoneGap
, HTML, CSS, JavaScript, Photoshop -
free C# book, C#, Java, C# -
" "
" cloud " C# , ,