iosxcode

How can we remove comments from apple documentation code


Do we have any shortcut to remove iOS documentation commnets? When we copy the code from apple documentation it's copied along with ///. I would like to uncomment with the Xcode shortcut (if any).

///
///     struct PlayButton: View {
///         @Binding var isPlaying: Bool
///
///         var body: some View {
///             Button(action: {
///                 self.isPlaying.toggle()
///             }) {
///                 Image(systemName: isPlaying ? "pause.circle" : "play.circle")
///             }
///         }
///     }
///

Solution

  • My approach would be to edit multiple lines simultaneously and remove them.

    1. Hold ⌥ Option
    2. Drag your cursor from the first line (behind the 3rd slash) to the last line (so in a straight line down)
    3. You're now editing multiple lines. Press delete 3 times to remove the slashes, then escape to exit this mode.

    So in short: ⌥ Option + drag down on the lines you want to edit.