Upload
joseph-ku
View
428
Download
1
Embed Size (px)
DESCRIPTION
2014-06-17 Presented on Ruby Tuesday #29
Citation preview
Swift Introduction to Swift in Ruby
@josephku
370,000
Safe Modern Power
No base class
@objc
Playground
Visual REPL
Use constant
letvar
Unicode
π
String Interpolation
let name = "Afu"let age = 3let greetings = "Hi! My name is \(name). My human age is \(age * 7)"println(greetings)
puts "Hi! I am #{name}. My human age is #{age * 7}"
Array & Dictionary
Array & Hash
1..10 1…10
if true { println("only me!")}
Functional Programming
Structure & Class
Extensions
500.repeatitions { println("Me again!") }
500.times { puts "Me again!" }
Tuple
let someTuple: (Double, Double) = (3.14159, 2.71828)
?
var serverResponseCode: Int? = 404serverResponseCode = nil
Optional Chaining
num = paul.residence?.address?.buildingNumber?.toInt()
RubyMotion
C’mon, it’s Ruby!!
?
Thank you!