jdog
jdog

Reputation: 10759

In objective-c what kind of method is this?

Going through some code and found a method like this in an iOS project. What is this?

Define:

void updateThing(){
   //....
}

Used like this:

updateThing();

Upvotes: 0

Views: 40

Answers (1)

Linuxios
Linuxios

Reputation: 35783

This is not a method. It's a C function, something that's part of C, the language objective-c is based on.

They have nothing to do with Objective-C classes or objects, although a C function in Obj-C can both take Objective-C objects as arguments and return them.

C functions are defined as follows:

returntype name(argtype arg1, argtype arg2) {
}

They are global (not called within some kind of scope), and have no self.

Upvotes: 3

Related Questions