공식문서 톺아보기/Swift API Design Guidelines
Swift API Design Guidelines - 2
Swift API Design Guidelines - 2
2023.03.13[3] Conventions (1) General conventions computed property의 복잡도가 O(1)이 아니라면 복잡도를 주석으로 남겨주세요. import Founcation /// Time Complexity: O(n^2) class Company { var numberOfEmployees: Int { var result: Int = 0 (0...n).forEach { (0...n).forEach{ (0...n).forEach{ result += 1 } } } return result } } 전역 함수 대신에 method와 property를 사용하세요. 전역 함수는 아래와 같이 특수한 경우에만 사용됩니다. // 명확한 self 가 없는경우 min(x, y, z) //function..
Swift API Design Guidelines - 1
Swift API Design Guidelines - 1
2023.03.13[1] Foundamentals 사용할 때 명확하게 느끼는 것이 가장 중요합니다. 명확한 것이 간결한 것보다 중요합니다. let blackButton (👍) let blackBtn (👎) 모든 선언에 대해 문서 주석(Documentation Comment) 를 작성해 주세요 /// Writes the textual representation of each /// element of `items` to the standard output. /// ← Blank line 빈줄 /// The textual representation for each item `x` /// is generated by the expression `String(x)`. /// /// - Parameter separator: tex..