Data and Accessor Properties

In order to define a property we use Object’s defineProperty method on a particular object. There is the value we want to initialize with, which is the passed in parameter of var firstName. The second writable simply means if we can write over it.

Creating Objects and Factory Functions

javascript old school way of creating objects:

New style of creating object

Factory functions Passing in parameters

Thus, you can just go

Constructor functions

‘this’ keyword

ref – http://javascriptissexy.com/understand-javascripts-this-with-clarity-and-master-it/ this property—a variable with the value of the object that invokes or calls the function where this is used.

person.greet(); “my name is ricky”. The this reference ALWAYS refers to (and holds the value of) an object—a singular object—and it is usually used inside a function or a method, although it […]

Primitives and Objects

Primitive types: String Number Boolean Undefined Null Reference types. Objects: Object Array Function Date RegExp Example “hello”.length But how? new String(“hello”).length; notice the constructor

type of obj –> “object” typeof String(“hello”) –> “string” obj.valueOf(); –> “hello” typeof obj.valueOf(); –> “string” Only way to create object is by using new String. All others will give […]

Identity vs Equality aka (strict vs abstract)

=== is called Identity Operator compares value AND type. == will do type conversion. Namely, it converts the type down to a comparable value and match that way.

Notice that true != “true”, I want to comment that by rule 5, since true is Boolean, it gets converted into a number. Hence, 1 […]

remove storyboard and start with empty project

ref – http://codefromabove.com/2014/09/xcode-6-removing-storyboards-and-creating-useful-empty-projects/ Xcode 5 and 6 introduced some changes in iOS project templates, which may or may not be to everyone’s taste. This mini-tutorial shows how to create a pre-Xcode 5-style Single View Application based on xib files, and and a pre-Xcode 6-style Empty Application, using Xcode 6. You get not only a Main.storyboard […]

dynamic binding vs static binding

ref -http://www.tutorialspoint.com/objective_c/objective_c_dynamic_binding.htm Dynamic binding is determining the method to invoke at runtime instead of at compile time. Dynamic binding is also referred to as late binding. In Objective-C, all methods are resolved dynamically at runtime, due to having every class must derive from NSObject. The exact code executed is determined by both the method name […]

@dynamic

Definitions @synthesize will generate the getter and setter methods of the properties if the getter and/or setter has not already been implemented manually. This is what you currently believe @dynamic does. @dynamic is used when you don’t want the runtime to automatically generate a getter and setter AND you haven’t implemented them manually. Basically, @dynamic […]

Core Data part 1 and 2 – data model and data stack

DEMO PROJECT Create a Single Project name it “CoreDataTut” We’re going to do everything by scratch so do not check the Core Data box. Leave it blank. Generate a xcdatamodeld file Once the project is generated, look at your list view on the left side. We need a .xcdatamodeld file, which represents the model diagram […]