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 | 29 | 30 | 31 |
Tags
- rxswift
- SWIFT
- Protocol
- UICollectionView
- Xcode
- RxCocoa
- UITextView
- HIG
- 클린 코드
- tableView
- 리팩토링
- clean architecture
- Refactoring
- swift documentation
- Human interface guide
- map
- ios
- collectionview
- combine
- MVVM
- 스위프트
- 애니메이션
- Clean Code
- uiscrollview
- swiftUI
- Observable
- uitableview
- 리펙토링
- ribs
- 리펙터링
Archives
- Today
- Total
목록2022/12/15 (1)
김종권의 iOS 앱 개발 알아가기
[iOS - Swift] 스위프트에서의 singleton 싱글톤 동작 이해하기 (lazy, thread safe)
싱글톤 패턴 인스턴스는 오직 한개를 사용하고, 라이프사이클 동안 절대 해제되지 않는 하나의 인스턴스 유지 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