Best way to define private methods for a class in Objective-C

后端 未结 12 1959
小鲜肉
小鲜肉 2020-11-22 14:34

I just started programming Objective-C and, having a background in Java, wonder how people writing Objective-C programs deal with private methods.

I understand there

12条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 15:05

    As other people said defining private methods in the @implementation block is OK for most purposes.

    On the topic of code organization - I like to keep them together under pragma mark private for easier navigation in Xcode

    @implementation MyClass 
    // .. public methods
    
    # pragma mark private 
    // ...
    
    @end
    

提交回复
热议问题