Xcode 11 now makes “//MARK:” comments a lot more useful with Minimap feature

Mumtaz Hussain
2 min readDec 13, 2019

--

Apple is always making Xcode more developer-friendly and easily manageable with each (stable) update.

//MARK:

In order to make our code easily readable, approachable and manageable in Xcode, a best practice to follow is that we divide its different aspects into groups and put a “//MARK:” (or “#pragma mark” in Objective-C) above each group with a descriptive comment, like this:

using //MARK- with some Swift code

Minimap in Xcode 11

A new feature is introduced in Xcode 11 that is called minimap where we can see overview of our code, that is visible on the right side of the code screen. We can easily navigate to any part of our code in a module, without much scrolling, by simply clicking anywhere on minimap:

Minimap without //MARK

Now comes the best part:

If we use “//MARK:” comments with description, we will be able to see those marks’ description inside minimap too. This is how minimap will look like:

Minimap with //MARK - descriptions

This technique makes our minimap readable which helps us visualise our code’s overview efficiently, and can be used to access any desired part of our code by just clicking on a description written on minimap. Cheers!

//MARK:- End of this article.

--

--