0

I am new to iOS. I have defined the following method in a .m file and need to add its name to the .h file.

-(Boolean) addBookFromArrayOne:(Book*)bookOne bookTwo:(Book*)bookTwo mergeByThisField:(NSString*)field sortDescending:(Boolean)

This post Method Syntax in Objective C was very helpful in learning the Objective C method syntax. The answer

in Objective-C, the name of a method is composed of all of the portions of the declaration that are not arguments and types. This method's name would therefore be: pickerView:numberOfRowsInComponent:

was particularly helpful.

But it does not show how to generalize to multiple parameters.

I took a guess at the syntax in the header file but am clearly getting it wrong:

@property Boolean addBookFromArrayOne:bookTwo:mergeByThisField:sortDescending;

Can somebody show me how to define this method name in the header file?

Community
  • 1
  • 1
bernie2436
  • 22,841
  • 49
  • 151
  • 244

2 Answers2

2

Just copy method declaration from implemetation to header

-(Boolean) addBookFromArrayOne:(Book*)bookOne bookTwo:(Book*)bookTwo mergeByThisField:(NSString*)field sortDescending:(Boolean)desc;
bernie2436
  • 22,841
  • 49
  • 151
  • 244
NeverBe
  • 5,213
  • 2
  • 25
  • 39
0

Don't use a property to declare a method; to declare a method in your header file just write:

-(Boolean) addBookFromArrayOne:(Book*)bookOne bookTwo:(Book*)bookTwo mergeByThisField:(NSString*)field sortDescending:(Boolean)descending;
edzio27
  • 4,126
  • 7
  • 33
  • 48