pragma mark in Objc organization style

Hi

Yesterday I was finishing a project on Objc, and then found a code organization style, and then responsible for this style of colleague B found me and said he kind of thing specification writing, I recommend this kind of not official, for the code neatness and readability requirements, I came here to seek an answer, although this problem does not affect the logic of the code, I still want a standard answer. But I still want a standard answer, before I have searched and asked a lot of people are recommended to write my way, and finally colleagues B also said that I may have problems with this way of writing, so I missed any details?

  • Colleague B's recommended writing style
#pragma mark -
#pragma mark Initialization
  • My recommended writing style
#pragma mark - Initialization

Best wishes!

Answered by DTS Engineer in 694026022

AFAICT Xcode renders these identically. Unless you’re using some other tool that renders them differently, I think it comes down to a question what you want your code to look like.

Speaking personally I prefer:

#pragma mark - Initialization

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

AFAICT Xcode renders these identically. Unless you’re using some other tool that renders them differently, I think it comes down to a question what you want your code to look like.

Speaking personally I prefer:

#pragma mark - Initialization

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

pragma mark in Objc organization style
 
 
Q