Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- RxCocoa
- 리펙토링
- ios
- SWIFT
- Clean Code
- Observable
- swiftUI
- collectionview
- UITextView
- 리팩토링
- uiscrollview
- combine
- MVVM
- Protocol
- tableView
- uitableview
- clean architecture
- UICollectionView
- Refactoring
- 리펙터링
- 애니메이션
- Human interface guide
- ribs
- Xcode
- 스위프트
- rxswift
- HIG
- map
- swift documentation
- 클린 코드
Archives
- Today
- Total
목록싱글톤 패턴 주의 사항 (1)
김종권의 iOS 앱 개발 알아가기
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/Ubkse/btrTEQDB9Bp/dkN8ygfteHeBRWte45p0F1/img.png)
싱글톤 패턴 인스턴스는 오직 한개를 사용하고, 라이프사이클 동안 절대 해제되지 않는 하나의 인스턴스 유지 swift에서는 static와 함께 전역변수로 선언하면 lazy하게 동작하는 장점이 존재 swift에서는 멀티 스레드에서 singleton을 사용해도 thread safe한 장점이 존재 (아래에서 계속) public class MyClass { static let shared = MyClass() private init() {} public func printSome() { print("some") } } MyClass.shared.printSome() swift에서의 싱글톤 동작 singleton 패턴은 SRP(Single Responsibility Principle) 원칙을 위반 SRP원칙이란 하..
iOS 응용 (swift)
2022. 12. 15. 02:02