ios - What does it mean to "conform to protocol" in Objective-C/Xcode? -


i came across lot of "this thing conforms protocol" when working on tutorial ios apps. mean?

there 2 types of see:

  1. along lines of id <nsfetchedresultssectioninfo> sectioninfo = [self.fetchedresultscontroller sections] [section];

  2. by setting delegate self , having implement delegate method or similar that.

what difference , why doing that?

edit: https://stackoverflow.com/a/22794742/5020627

a protocol promise implement methods. conform protocol means both make promise , fulfill it.

your example of id <nsfetchedresultssectioninfo> "any kind of object implements required methods of protocol nsfetchedresultssectioninfo." (id in objective-c means "any kind of object.")

most setdelegate: methods require argument conform protocol. before assigning delegate, need make sure add promise (as part of @interface) , implement methods (to fulfill promise).


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -