본문 바로가기

전체 글97

팬제스처와 네비게이션 팝(뒤로가기) 제스처가 상충되는 문제 해결하기 문제 현재 회사에서 개발중인 앱에는 가로 스크롤이 가능한 스크롤뷰(콜렉션뷰 포함)들이 각 화면에 다양하게 존재하고 있습니다. 문제는 기기의 왼쪽 엣지를 오른쪽으로 쓸어넘겨서 뒤로가기(interactivePopGesture)를 하고 싶어도 할 수가 없고 스크롤뷰의 가로방향 팬제스처만 인식한다는 겁니다. 특히 화면 전체를 가로 스크롤 가능한 콜렉션뷰가 덮고 있는 화면들이 좀 있는데요. 이 경우에는 특히나 사용성이 떨어집니다. 반드시 좌상단에 있는 뒤로가기 버튼을 탭해줘야만 네비게이션의 이전 스택으로 팝을 할 수 있기 때문이죠. 해결 방법은 간단합니다. UIGestureRecognizerDelegate의 메소드 중 두 제스처인식기가 인식되었을 때 그 중 하나의 인식을 실패하게 할 지를 결정하는 메소드 gest.. 2020. 7. 4.
[WWDC20] Advances in diffable data sources Advances in diffable data sources - WWDC 2020 - Videos - Apple Developer Advances in diffable data sources - WWDC 2020 - Videos - Apple Developer Diffable data sources dramatically simplify the work involved in managing and updating collection and table views to create dynamic and... developer.apple.com 개요 이 비디오에서는 iOS 14 용 Diffable Data Source의 발전에 대해 다루고 있습니다. 샘플코드를 실행하면 첫 번째 섹션에는 가로로 스크롤되는 이모.. 2020. 6. 28.
[WWDC20] Lists in UICollectionView Lists in UICollectionView - WWDC 2020 - Videos - Apple Developer Lists in UICollectionView - WWDC 2020 - Videos - Apple Developer Learn how to build lists and sidebars in your app with UICollectionView. Replace table view appearance while taking advantage of the full... developer.apple.com 영문세션을 번역하였습니다. 오역이 있을 수 있습니다. 잘못된 부분이 있다면 알려주세요! 본 세션에서는 다루지 않는 내용을 배울 수 있는 세션들은 무엇이 있는지 알려줍니다. 학습에 참고하세요. .. 2020. 6. 25.
[ARKit] Sample Code: Placing Objects and Handling 3D Interaction https://developer.apple.com/documentation/arkit/placing_objects_and_handling_3d_interaction Placing Objects and Handling 3D Interaction | Apple Developer Documentation Sample Code Placing Objects and Handling 3D Interaction Place virtual content at tracked, real-world locations, and enable the user to interact with virtual content by using gestures. Download OverviewThe key facet of an AR experi.. 2020. 6. 21.
[ARKit]Ray-Casting Ray-Casting and Hit-Testing Raycasting and Hit-Testing | Apple Developer Documentation Raycasting and Hit-Testing Find points on real-world surfaces given a screen location. OverviewRaycasting is the preferred method for finding positions on surfaces in the real-world environment, but the hit-testing functions remain present for compatibilit developer.apple.com ARRaycastQuery 실제 세계의 표면에서 3D 위치를 .. 2020. 6. 21.
[ARKit] Scene Understanding ehdrjsdlzzzz/ARKit-example protocorn93/ARKit-example Studying ARKit. Contribute to protocorn93/ARKit-example development by creating an account on GitHub. github.com 개요 면 감지(Plane Detection) 만일 하나의 테이블이 존재하고 그 위에 오브젝트를 하나 올린다고 하자. 우리는 이 테이블을 인식할 필요가 있고 이 테이블을 하나의 면(Plane)이라고 인식해야 오브젝트를 단순히 띄우는 것이 아닌 테이블 위에 올려놓을 수 있다. Hit-testing 이렇게 면이 감지되면 오브젝트를 위치시키는데 필요한 3D 좌표점을 찾아야 하는데 이를위해 사용되는 것 이러한 좌표점은 디.. 2020. 6. 21.
MVVM 아키텍쳐 적용하기 MVVM 아키텍쳐 적용하기 어렵지 않아요~ 1. class ViewModel 만들기 2. VC에 ViewModel 객체 만들기 3. VC에서 UI와 관련된 비지니스로직을 ViewModel로 옮긴다. 4. VC의 UI 처리 부분을 input과 output으로 나눈다. 5. input을 받으면 ViewModel로 넘겨주도록 observer를 선언해 놓는다. 6. ViewModel에서는 input에서 넘겨 받을 함수나 변수를 준비한다. 7. ViewModel에서 계산된 결과를 넘겨주면 받을 수 있도록 observer를 만든다. 8. 계산된 결과를 넘겨줄 Observable을 만든다. ViewModel을 적용하고 나면 별거 없다는 것을 알게될 겁니다. 9. ViewModel의 계산된 결과를 VC에서 기다리고 있.. 2020. 6. 17.
SwiftHub Login ViewController / ViewModel 분석 LoginViewController bindViewModel() override func bindViewModel() { super.bindViewModel() guard let viewModel = viewModel as? LoginViewModel else { return } let segmentSelected = Observable.of(segmentedControl.segmentSelection.map { LoginSegments(rawValue: $0)! }).merge() let input = LoginViewModel.Input(segmentSelection: segmentSelected.asDriverOnErrorJustComplete(), basicLoginTrigger: basicLog.. 2020. 6. 17.
You don’t (always) need [weak self] (해석) You don't (always) need [weak self] - Flawless iOS - Medium You don’t (always) need [weak self] We will talk about weak self inside of Swift closures to avoid retain cycles & explore cases where it may not be necessary to capture self weakly. medium.com In closure let changeColorToRed = DispatchWorkItem { [weak self] in self?.view.backgroundColor = .red } 이 클로저에서 self가 어떻게 약하게 캡쳐되었는지 주목하십시오. 결국 .. 2020. 6. 17.
Swift: How to Migrate MVC to MVVM Swift: How to Migrate MVC to MVVM & Intro Unit Testing 1. 기능이름ViewModel.swift 생성 class 기능이름ViewModel or struct 기능이름ViewModel 만들기 class/struct 안에 필요한 변수와 생성자 만들기 (의존성 주입) 의존성 주입 struct CourseViewModel { let name: String // Dependency Injection (DI) init(course: Course) { self.name = course.name } } 2. VC에 있는 Model 객체(e.g. fetchArray)를 ViewModel 객체로 변경 class CoursesController: UITableViewControlle.. 2020. 6. 17.
커링 (Currying) 20세기 수학자인 Haskell Curry 등의 작업으로 수학에서 유래한 언어 기술 여러개의 파라미터를 받는 함수를 하나의 파라미터를 받는 여러 개의 함수로 쪼개는 것 func multiply(_ a: Int) -> (Int) -> Int { return { b in return a * b } } let area = multiply(10)(20) //200 커링을 하는 이유 함수의 합성을 원활하게 하기 위해서 입니다. 함수의 Output이 다른 함수의 Input으로 연결되면서 합성될 때 함수들이 서로 chain을 이루면서 연속적으로 연결이 되려면, Output과 Input의 타입과 갯수가 같아야 합니다. 함수의 Output은 하나밖에 없으니 Input 또한 모두 하나 씩만 갖도록 한다면 합성하기가 쉬워질.. 2020. 6. 16.
RxSwift to Apple’s Combine “Cheat Sheet” https://medium.com/gett-engineering/rxswift-to-apples-combine-cheat-sheet-e9ce32b14c5b RxSwift to Apple’s Combine “Cheat Sheet” Get started with Apple’s Combine with your existing RxSwift knowledge medium.com RxSwift와 Apple의 Combine을 위한 양방향 유형의 브리징을 위한 개념 증명을 제공하는 RxCombine이라는 라이브러리를 출시했는데, 필요에 따라 코드에 있는 두 유형을 혼합하고 일치시킬 수 있다. RxSwift와 콤바인 사이에 직접 관련이 있는 것들을 지도화하려고 한다. 이것이 실제적인 마이그레이션 과정을 훨씬 더 쉽게 .. 2020. 6. 16.
Combine framework First look at Apple's new Combine framework - Q42 Engineering - Medium Combine | Apple Developer Documentation RxSwift와 Combine 비교 RxSwift에서 새로운 입력 Observables를 만드는 것은 매우 쉽습니다. 예를 들어 다음과 같이 할 수 있습니다. // Using RxSwift Observables let observable: Observable = Observable.create { observer in // 비동기 아무거나. (예를 들면 네트워크 요청) DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(2), execute: { observ.. 2020. 6. 16.
SwiftUI - Introduction SwiftUI by Example - free quick start tutorials for Swift developers SwiftUI란 무엇인가? SwiftUI는 선언적 방식으로 앱을 디자인 할 수 있는 사용자 인터페이스 툴킷입니다. 명령형 UI (Imperative UI) 버튼을 클릭할 때 함수를 호출 할 수 있고 함수 내부에서 값을 읽고 레이블을 표시한다. 정기적으로 사용자 인터페이스의 모양과 동작을 변경해야 한다. 명령형 UI는 모든 종류의 문제를 일으키는데 대부분의 문제는 상태(코드에 저장한 값)를 기반으로 발생합니다. 코드의 상태를 추적하고 사용자 인터페이스가 해당 상태를 올바르게 반영하는지 확인해야합니다. UI에 영향을 주는 두 개의 Bool 속성이 있는 화면에서 Bool은 4가지 상태가 .. 2020. 6. 15.
Concurrency Problems - Concurrency by Tutorials Chapter 5: Concurrency Problems Concurrency by Tutorials In this part of the book, you're going to learn about the basics of Concurrency. You're going to learn what it is, what kind of problems it solves, and why would you even use it? Further, you will learn the basic pieces of which Concurrency comprises in Cocoa development: Grand Central Dispatch and Operations. https://store.raywenderlich.c.. 2020. 6. 14.
Groups & Semaphores - Concurrency by Tutorials Chapter 4: Groups & Semaphores Concurrency by Tutorials In this part of the book, you're going to learn about the basics of Concurrency. You're going to learn what it is, what kind of problems it solves, and why would you even use it? Further, you will learn the basic pieces of which Concurrency comprises in Cocoa development: Grand Central Dispatch and Operations. https://store.raywenderlich.co.. 2020. 6. 14.
Queues & Threads - Concurrency by Tutorials Chapter 3: Queues & Threads Concurrency by Tutorials In this part of the book, you're going to learn about the basics of Concurrency. You're going to learn what it is, what kind of problems it solves, and why would you even use it? Further, you will learn the basic pieces of which Concurrency comprises in Cocoa development: Grand Central Dispatch and Operations. https://store.raywenderlich.com/p.. 2020. 6. 14.
GCD & Operations - Concurrency by Tutorials https://store.raywenderlich.com/products/concurrency-by-tutorials Section 1: Getting Started with Concurrency Chapter 1: Introduction iOS가 코드를 동시에 실행할 수있는 기능을 제공하는 두 가지 주요 방법 Grand Central Dispatch Operation class 최신 프로그래밍 언어들의 서로다른 동시성 처리 매커니즘 C# / Typescript async / await 패턴 사용 Swift Closure Swift 5는 원래보다 일반적인 async / await 패턴을 구현할 계획이 있었지만 다음 릴리스까지 사양에서 제거되었습니다. Chapter 2: GCD & Operations 앱의.. 2020. 5. 23.
Materialize/dematerialize fimuxd/RxSwift https://rhammer.tistory.com/304 Materialize/dematerialize third party 프레임워크에 의해 생성될 수 있는, sequence 제어가 제한되거나 제어가 불가능해서 발생하는 에러를 처리하는 해결책. 관찰 가능 이벤트를 관찰 가능 이벤트로 변환하려는 경우가있을 수 있습니다. 이것이 유용한 일반적인 시나리오 중 하나는 관찰 가능한 속성이있는 관찰 가능 개체를 제어 할 수없고 외부 시퀀스가 ​​종료되지 않도록 오류 이벤트를 처리하려는 경우입니다. materialize 연산자는 어떤 sequence든 Event enum sequence로 변환한다. Original Data → X Data → Completed Materialized Ev.. 2020. 5. 16.
Test Driven Development in Swift Let's TDD - 전수열 devxoul/LetsGitHubSearch devxoul/LetsGitHubSearch Let'Swift 18 Workshop - Let's TDD. Contribute to devxoul/LetsGitHubSearch development by creating an account on GitHub. github.com TDD의 핵심 RED 테스트 작성 → 구현이 없어서 실패 GREEN 테스트를 통과할 수 있는 최소한의 구현 REFACTOR 테스트의 존재 덕분에 안전한 리펙토링 가능 TDD는 단순하지만, 테스트를 작성하는 능력이 더 중요하다 나의 앱에 TDD를 도입하기 어려운 이유 의존성 주입이 되어있지 않음 (모든 곳에 커플링이 걸려있음 → 네트워크를 분리하기 어려움) 뷰.. 2020. 3. 8.