ahcode0919
4/28/2017 - 11:33 AM

Comment formatting in Swift

Comment formatting in Swift

import Foundation

/// General doc comment
struct SomeClass {
    private static  var count: Int = 0
    let aString: String
    
    // MARK: - Initializers
    
    init(aString: String) {
        self.aString = aString
        SomeClass.count += 1
    }
    
    // TODO: Add nullable initializer
    //init?(aString: String?) {
    //
    //}
    
    // MARK: - Class functions
    
    /// Get total number of
    ///
    /// - Returns: return value description
    static func getCount() -> Int {
        // FIXME: Change to String
        return count
    }
    
    // MARK: - Instance functions
    
    /// Function description
    ///
    /// - Parameter afterAppending: parameter description
    /// - Returns: return value description
    func getAString(afterAppending: String?) -> String {
        return afterAppending != nil ? "\(aString)\(afterAppending)": aString
    }
}