일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 클린 코드
- tableView
- Clean Code
- map
- Xcode
- collectionview
- Human interface guide
- uitableview
- HIG
- ios
- 애니메이션
- UICollectionView
- MVVM
- 리펙터링
- RxCocoa
- Observable
- UITextView
- ribs
- clean architecture
- uiscrollview
- combine
- Protocol
- 스위프트
- SWIFT
- Refactoring
- swiftUI
- 리팩토링
- rxswift
- 리펙토링
- swift documentation
- Today
- Total
목록DispatchQueue (11)
김종권의 iOS 앱 개발 알아가기
기본지식 1) capture list 개념 closure = { [weak self] in // Void)? } 그래서 보통 위와 같은 전역변수가 아닌, 함수 or 메서드에 @escaping 키워드를 붙이는 것 func someFunc(_ closure: @escaping (Void) -> Void) { } 기본지식 3) [weak self]를 안써서 memory leak을 일으키는 코드 SomeClass의 setupClosure() 메서드를 보면 closure를 assign할 때 self를 집어넣음 -> retain cycle 발생 1) SomeClass 인스턴스가 closure 프로퍼티 참조 2) closure 프로퍼티가 SomeClass 인스턴스 참조 (이 부분이 클로저 안에서 self를 참조해서 ..
dataSource 관리 MVVM 구조에서 보통 dataSource를 사용할 때 아무런 큐 없이 구현하지만, 데이터 처리 최적화를 위해 background 시키고 싶은 경우 중간중간 DispatchQueue.global()를 사용하거나 커스텀 큐를 사용하는 경우가 존재 개발자가 실수로 DispatchQueue.global()를 사용하게 되면, 이 큐는 serial이 아닌 concurrent이므로 value type인 dataSource 배열을 수정과 동시에 읽기를 하다가 크래시가 발생하는 경우가 존재 크래시 - 이전 Memory Access Conflict 글 참고 이럴때는 커스텀 큐를 선언하여 관리하는것이 가장 좋은데, 먼저 queue의 종류를 이해가 필요 DispatchQueue의 종류 3가지 * 이..
DispatchQueue 개념 DispatchQueue 개념 앱의 main 또는 background 스레드들을 순차적 or 스레드 세이프하게 동시 처리하는 작업 큐 DispatchQueue.main은 serial queue이며, sync한 메인 스레드에서 돌아가는 작업 큐 DispatchQueue의 종류 main queue (serial) global queue (concurrent, qos 설정 가능) custom queue(디폴트는 serial이고 concurrent로 설정 가능) RunLoop 개념 입력 소스(터치, 등)와 타이머 소스에 관한 이벤트 처리를 할 때 하나의 loop를 두고 그 loop안에서 이벤트를 받고 처리하는 부분을 나누는데 이때의 loop를 runloop라고 명칭 (아래 그림에서..
DispatchQueue의 종류 main queue (serial queue) global queue (concurernt, qos 설정 가능) custom queue (디폴트는 serial이며 concurrent로 변경 가능) global queue DispatchQueue.global(qos:) global queue는 모두 concurrent queue임을 주의 qos는 Dispatch.QoS.QoSClass 타입 concurrent 큐이고 qos 설정이 가능 qos(quality of service) // 애니메이션과 같은 UI 즉시 업데이트가 필요하며, 멈춘것처럼 보이지 않는 작업들 (유저의 반응) DispatchQueue.global(qos: .userInteactive) // 저장된 문서를 ..
1. Concurrent Programming - NSLock, DispatchSemaphore 사용 방법 2. Concurrent Programming - DispatchSemaphore로 코틀린의 CompletableDeferred 구현방법 3. Concurrent Programming - DispatchQueue의 serial, concurrent, async, sync 이해하고 사용하기 4. Concurrent Programming - Thread Safe Array 구현방법 (DispatchQueue의 barrier 사용) 5. Concurrent Programming - OperationQueue로 동적으로 작업 추가, 취소하는 모듈 구현방법 Operation Queue 동시성 프로그래밍에서 ..
1. Concurrent Programming - NSLock, DispatchSemaphore 사용 방법 2. Concurrent Programming - DispatchSemaphore로 코틀린의 CompletableDeferred 구현방법 3. Concurrent Programming - DispatchQueue의 serial, concurrent, async, sync 이해하고 사용하기 4. Concurrent Programming - Thread Safe Array 구현방법 (DispatchQueue의 barrier 사용) 5. Concurrent Programming - OperationQueue로 동적으로 작업 추가, 취소하는 모듈 구현방법 * 해당 글을 이해하기 위해서는 이전 포스팅 글(D..
1. Concurrent Programming - NSLock, DispatchSemaphore 사용 방법 2. Concurrent Programming - DispatchSemaphore로 코틀린의 CompletableDeferred 구현방법 3. Concurrent Programming - DispatchQueue의 serial, concurrent, async, sync 이해하고 사용하기 4. Concurrent Programming - Thread Safe Array 구현방법 (DispatchQueue의 barrier 사용) 5. Concurrent Programming - OperationQueue로 동적으로 작업 추가, 취소하는 모듈 구현방법 기본지식) DispatchQueue에서의 seria..
사전 지식) 스위프트의 스레드 스위프트의 main queue는 serial queue이므로, 한 task가 끝나고 난 후에 다음 task를 실행 만약 main.sync로 실행시키면 이 serial queue에 작업이 끝날 때 까지 그 코드에 머물러 있는 상태 queue가 block되고 queue에 넣은 작업들이 완료될때까지 wait 상태 serial queue이므로 이미 block 상태가 되었기 때문에 deadlock 발생 thread safe하게 사용하려면, background thread에서 main.async를 사용하여 순서에 맞게 UI업데이트가 되도록 구현 크게 main(serial)과 global(concurrent)가 존재 async와 concurrent의 차이 async, sync 단일 작업..