일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- swift documentation
- 스위프트
- uitableview
- 리펙토링
- Xcode
- swiftUI
- Human interface guide
- HIG
- UICollectionView
- MVVM
- map
- 리펙터링
- combine
- Refactoring
- 애니메이션
- clean architecture
- UITextView
- Protocol
- tableView
- 리팩토링
- collectionview
- rxswift
- SWIFT
- ios
- uiscrollview
- Observable
- 클린 코드
- Clean Code
- ribs
- RxCocoa
- Today
- Total
목록DispatchQueue (12)
김종권의 iOS 앱 개발 알아가기
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/v4BUZ/btsJQg5xUZX/V7vJJNyL0bqA5Raqd2UNDK/img.png)
DispatchQueue 작업 취소, 예약 방법5초 후에 특정 작업을 수행하고 싶은 경우?보통은 DispatchQueue 사용DispatchQueue.main.asyncAfter(deadline: .now() + 5) { // some task...}5초 후에 특정 작업을 수행하려고 하지만, 중간에 버튼을 누르면 이 작업을 취소하고 싶은 경우?DispatchSourceTimer 사용DispatchSourceTimer 개념타이머를 설정해놓고 특정 작업을 setEventHandler 클로저로 실행시킬 수 있는 기능이것을 사용하면 작업을 등록해놓고 cancel, pause 모두 다 가능DispatchSourceTimer 사용 방법인스턴스 하나를 두고 cancel(), pause()할 수 있도록 전역으로 ..
기본지식 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가지 * 이..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cBpOM5/btrXZPOAmAj/YVqkgBYBAYq9noK44iupa0/img.png)
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라고 명칭 (아래 그림에서..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/djnIOp/btrSOyqUNn3/NhsLmIIJPdXy35VppEs2Z1/img.png)
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) // 저장된 문서를 ..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cFSu6t/btrI2VVRZ9D/qLWpQdtlhQCKA8Ip2pOxn0/img.gif)
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..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/0BDGw/btrI1V9zS2U/swRkDqHH08ZDv647BOwqXk/img.png)
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..