-
210215 TIL: POP-4.Generic, lhs/rhs, declaration orderTIL 2021. 2. 15. 23:40
POP
https://welly-log.tistory.com/11?category=920557
Swift4: Protocol Oriented Programming - 4.제네릭
4장 제네릭 제네릭은 중복을 피하고, 유연하고 재사용 가능한 코드를 작성할 수 있게 해준다. 스위프트의 Array나 Set 같은 경우 모두 제너릭 구조체로 구현되어 있다. enum Optional { case None case Some(T)
welly-log.tistory.com
lhs와 rhs에 대한 흥미로운 글
lhs 와 rhs
연산자 함수를 만들 경우 함수의 매개변수를 적어줄때 변수 이름으로 lhs(Left Hand Side) 와 rhs(Righ...
blog.naver.com
- lhs: left hand side
- rhs: right hand side
클래스 메소드에서의 인자일 때는 rhs를 쓴다 → 왜? (는 위글에 나와있음)
Declaration Order
public mutating func getItem() mutating private func checkUniquelyReferencedInternerQueue()
공부하다가 이런 예제 코드를 봤는데 위의 경우에서는 접근 지정자가 mutating 키워드 앞에, 아래에는 mutating 키워드가 접근 지정자 앞에 와있고 Xcode상에 에러도 안나서 어느게 더 선호되는지 궁금해졌다.
Swift Declaration Order – Haoxin Li
There are a few good Swift coding style guides out there, but they don’t have much to say about how to organize a Swift source file and put things in a good order. I searched “swift declaration order” and didn’t see any article about it. As a resul
haoxin.li
그러던 중 연두가 좋은 글을 추천해줬다! 근데 여기에는 mutating 키워드 내용은 없을 뿐더러 출처도 뭔가 저자의 개인적 의견인 것 같아서 맹신할 건 아닌거 같다.
- non-IBOutlet > IBOutlet
이런 부분도 있어서 declaration 순서는 가독성과 개발자가 강조하고자하는 것에 달려있는게 아닌가,, 하는 심심한 결론.
'TIL' 카테고리의 다른 글
210217 TIL: POP-6.프로토콜지향 프로그래밍 (0) 2021.02.17 210216 TIL: POP-5.객체지향 프로그래밍, assert (0) 2021.02.16 210214 TIL: POP-3: extension, subscript, overload/override (0) 2021.02.14 210213 TIL: POP-2: type, 함수/메소드 (0) 2021.02.13 210212 TIL: POP, type, Xcode tip (0) 2021.02.12