문제 설명
재정의된 메서드에 대한 신속한 문서 주석? (Swift documentation comments for overriden methods?)
클래스가 UICollectionViewDataSource
를 준수한다는 사실 때문에 구현된 Swift 함수에 마크업 문서를 추가하고 싶습니다. 예:
///
/// ‑ returns: Why is this documentation ignored?
///
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) ‑> Int {
return 2
}
분명히 내 의견은 무시되고 생성된 문서는 계약 정의(또는 다른 기본 위치)에서 상속된 문서로 남아 있습니다. 빠른 도움말(Xcode 7.1.1)에는 다음 텍스트가 포함되어 있습니다.
Returns 섹션의 행 수입니다.
내 구현에서 변경 사항을 호출하기 위해 이러한 기본 문서를 "재정의"하려면 어떻게 해야 합니까?
참조 솔루션
방법 1:
Seems like in overridden functions you need to give the multi‑line comment (seems like /* */ doesn't work, you need /** */) instead of multi single‑lines. What is interesting, multi single‑line comments work fine for not overridden functions. What is even more interesting, as you are typing the method you get the correct, overridden comment, but Quick Help just ignores it once you type it off and click alt.
Example:
/**
Works fine as you are typing.
*/
override func viewDidAppear() {
print("test")
}
(by Drux、sunshinejr)