How to use swift Documentation ?

Documentation helps developers & peers to get through the code explanation, we often use ⌥ Option + click to find inbuilt apple documentation or we can just jump towards inspector area & click on any method it will appear the markup description on right panel

So Let’s start writing in our code example —

/// Get Link list middle node.
///
/// ```
///  print("Get link List middle node") // This is how you can write code in documents
/// ```
///
/// > Warning: Please use single linklist
///
///
/// - Parameters:
///     - head: Head of a link list
///
/// - Returns: A ListNode.
func middleNode(_ head: ListNode?) -> ListNode? {
    return head
}

Summary : Get Link list middle node.
Declaration : func middleNode(_ head: ListNode?) -> ListNode? {
Discussion: print("Get link List middle node") // This is how you can write code in documents
Warning: Please use single linklist
Parameters: head: Head of a link list
Returns: A ListNode.

You can find more here : https://janeshswift.com/ios/swift/how-to-use-mark-in-ios-swift/

Leave a Comment

Your email address will not be published. Required fields are marked *