Sunday, August 14, 2016

IPND, stage5, iOS

Apple invented a language called swift in 2014. So it’s a pretty new one and includes many good merits from other languages. Basically, its grammer is very similar to JavaScript. The nice part is swift introduces “struc“ that groups relevant data. And its IDE Xcode provide immediate feedback.
I am not interesting in developing a game now. But it’s good to know it.

learning sources:

support both inferred typing and explicit typing

Once the type is declared or set, it can’t change.
var mylove = “w” //inferred typing, will guess it as string
var mylove: Character =”w”//explicit typing
var islove: Bool = true
var secretNumber = 7
var price: Double = 2.50
let pi = 3.14 //constant


var, let, class, import, private, operator.
Hungarian Notation:
  • `intNumberOfLives
  • countNumberOfLives
  • sumTotalScore
Camel Casing:
  • totalCumulativeScore
  • secondsSinceLastUpdate
  • minutesTillLaunch
Naming constant:
  • PointsPerLife
  • DefaultGreeting
  • MaxLength
name for a struct a capital letter:
struct Student {
    let name: String
    var age: Int
    var school: String
var ayush = Student(name: "Ayush Saraswat", age: 19, school: "Udacity")