Why declare types for each object variable in Objective-C?

objective-c

Solution

Objective-C is not mixed with C, it's a proper superset of C with some dynamic features.

You can avoid the use of static typing on any Objective-C object variable and declare everything as `id`, but I don't see why would you want to do that. You would lose all the help the compiler is giving you thanks to the type information (provided or inferred).

To wrap it up, you don't need types, you want types.

Problem

Since Objective-C is a dynamic typing language, why do we still need types? Is the reason because it mixes with C code?

Original source

Related problems