전체 글
-
swift closure에서 사용하는 weak self 정체 알기카테고리 없음 2021. 6. 23. 09:56
swift에서 이런 것을 본 적이 있을 것이다. let alertAction = UIAlertAction(title: Title, style: .default, handler: { [weak self] guard let self = self else { return } self.DoDefaultAction(); }) handler 파라미터는 () -> Void 타입인 closure이다. closure 안에 [weak self]라는 것이 있는데...? 이번 글에서는 저 weak self의 정체가 무엇인지 알아보자. 일단, weak self의 정체를 알기 전에, 메모리 구조부터 이해할 필요가 있다. 일단 c나 c++같은 초기 언어의 메모리 구조를 먼저. 링크: 코딩의 시작, TCP School 아래는 c++..
-
Gimbal Lock카테고리 없음 2021. 5. 31. 22:35
역학에서 3차원 물체가 놓인 방향을 나타내기 위해 오일러 각을 사용한다. 아래 링크의 움짤이 오일러 각을 설명하기에 좋아보여서 가져옴... 위의 움짤을 참고하면서 아래의 설명을 읽으면 오일러 각을 이해할 수 있을 것이다. orientation이 0, 0, 0 일 때의 모습. 월드 좌표와 바디 좌표가 일치한다. z 축을 회전축으로 회전. 보통 ψ로 많이 표시한다. 현재 바디의 orientation은 ψ, 0, 0 ψ회전을 한 상태에서 바디 좌표계의 x축을 회전축으로 해서 회전한다. 보통 θ로 표현한다. 바디의 orientation은 ψ, θ, 0 ψ와 θ 회전을 한 상태에서 바디 좌표계의 x축을 회전축으로 회전한다. 보통 φ로 표현한다. 바디의 orientation은 ψ, θ, φ 3차원에서의 물체가 놓인..
-
Firestore DocumentSnapshot.exists()가 false를 반환할 때카테고리 없음 2020. 12. 24. 02:36
아래는 Firestore에 문서가 있는지 없는지 확인하는 방법을 구글링했을 때 나온 방법이다. java - Checking if a document exists in a Firestore collection - Stack Overflow DocumentSnapshot.exists()를 사용하는 방법이 대표 답변으로 채택되어있다. 아래는 채택된 답변의 코드를 그대로 복사해 온 것이다. FirebaseFirestore rootRef = FirebaseFirestore.getInstance(); DocumentReference docIdRef = rootRef.collection("yourCollection").document(docId); docIdRef.get().addOnCompleteListener(n..