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:
along lines of
id <nsfetchedresultssectioninfo> sectioninfo = [self.fetchedresultscontroller sections] [section];by setting delegate self , having implement delegate method or similar that.
what difference , why doing that?
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
Post a Comment