Ray Wenderlich
-
[CoreAnimation] Ch9. Animation Keys and Delegates (레이어 애니메이션 Delegate, Key를 사용하기)Ray Wenderlich/Core Animation 2018. 8. 1. 20:58
9장 Animation Keys and Delegates Intro UIView animation을 사용할 때, 애니메이션을 중지할 수 없었다. 하지만 Core Animation에선 모든게 가능!layer의 애니메이션은 멈출 수 있다. 더불어 delegate를 설정하여 애니메이션의 시작과 끝(or interrupted)에 대한 핸들링도 가능하다. Introducing animation delegates CAAnimationDelegate에는 두 메소드가 있다. func animationDidStart(_ anim: CAAnimation)func animationDidStop(_ anim: CAAnimation, finished flag: Bool) Key-value coding compliance CAA..
-
[CoreAnimation] Ch8. Getting started with Layer Animations. (레이어 애니메이션)Ray Wenderlich/Core Animation 2018. 7. 31. 22:20
8장 Getting Started with Layer Animations Section 3. Layer AnimationsView vs LayerLayer는 View와 다르다. Layer는 View를 표현하는데 필요한 데이터를 갖는 모델 객체다. Layer는 View와 어떻게 다른가?- 말 그대로 모델 객체! 데이터만 포함한다. 뷰의 로직에는 전혀 관여하지 않는다. 오토레이아웃 의존성이나 사용자 인터렉션에도 물론 관여하지 않는다.- View에 없는 visible trait가 존재한다. borderLine, borderColor, position, shadow 등- GPU는 레이어 정보를 캐싱하여, 화면에 그림을 그린다. Layer, View. 다시 한 번 비교Views- 복잡한 뷰 계층 구조를 갖는다. ..
-
[CoreAnimation] Ch7. Animating Constraints - (오토레이아웃으로 애니메이션하기)Ray Wenderlich/Core Animation 2018. 7. 31. 22:12
7장 Animating ConstraintsIntro이전에는 alpha, frame등의 변경으로 애니메이션을 구현했지만, AutoLayout은 좀 다르다.Constraint의 변경을 한 뒤, AutoLayout의 State변경을 통해 애니메이션을 구현한다. Making the menu expandNSLayoutConstraint도 UIView처럼 @IBOutlet으로 연결가능하다.연결한 Constraint의 constant를 변경해보자.뷰의 크기와 위치가 변하는걸 확인한다. 이제 애니메이션을 해보자. Animating layout changesConstraint의 constant를 변경하고 끝내면 애니메이션 없이 뷰가 변한다.하지만 여기에 UIView.animate(.... view.layoutIfNee..
-
RxSwift - combineLatest(), zip() 에 대해서 알아보자.Ray Wenderlich/RxSwift 2018. 7. 13. 02:41
Ch9. Combining operators p.186 - p.190 combineLatest그림을 보고 combineLatest가 어떤 기능을 할 지, 먼저 추측해보자.셜록급의 추리가 아니더라도, 어느정도 끄덕하게 될 만큼 직관적이다.두 개의 시퀀스가 combineLatest를 만나 하나의 시퀀스가 되었다.이 합쳐진 시퀀스는 서브 시퀀스(즉, left와 right)에서 이벤트가 발생할 때마다, 이벤트를 발생시킨다.합쳐진 시퀀스는 두 서브 시퀀스의 Element를 조합하여 새로운 Element를 전달한다. 첫 번째 예제우선 두 개의 시퀀스를 준비해보자.let left = PublishSubject() let right = PublishSubject() combineLatest를 사용하여 하나로 합쳐진 시..
-
RxSwift - merge()에 대해서 알아보자.Ray Wenderlich/RxSwift 2018. 7. 6. 02:23
Ch9. Combining Operators p.184 - p.186 merge()RxSwift에서 시퀀스를 합쳐주는 operator는 다양하다. 그 중, merge를 이용해 쉽게 접근해보자. 아래 그림을 보고, merge가 어떤 역할을 하는지 한번 짐작해보자. 어떤 역할을 하는지, 코드를 통해서 알아보자. (아래는 이미지입니다. 텍스트로 작성한 코드는 본문 최하단에 첨부)1. PublishSubject를 두 개 만들었다.2. Observable의 Observable을 만든다. source의 타입은 Observsble이다.3. merge()를 사용했다. merge()의 리턴 값을 subscribe하고 있다.4. leftValues에는 독일의 도시가, rightValues에는 스페인의 도시가 들어있다. l..
-
RxSwift - startWith(_:), concat(_:), concatMap(_:)에 대해서 알아보자.Ray Wenderlich/RxSwift 2018. 7. 5. 00:38
Ch9. Combining Operators p.179 - p.183 startWith(_:)Observable시퀀스 앞에 다른 값을 추가해주는 기능을 한다.그림과 코드를 보면 너무나도 간단하다!! (2, 3, 4)라는 시퀀스가 있고, 맨 앞에 1을 추가하고 싶다.이를 해결하기 위해 startWith(1)을 사용해보자.let numbers = Observable.of(2, 3, 4) let observable = numbers.startWith(1)observable.subscribe(onNext: { value in print(value) }) 사족을 다는 것보다, 이것으로 설명을 마치는게 제일 깔끔해보인다. concat(_:)결론부터 말하자면, startWith(_:)와 굉장히 흡사하다.startWi..
-
RxSwift - share(), share(replay:, scope:)에 대해서 알아보자Ray Wenderlich/RxSwift 2018. 6. 24. 17:30
p.125참조. ( 이번 포스트는 번역글이 아닙니다. :) ) share()Rx를 처음 시작할 때, 자주 실수하는 부분이 있다.Observable을 subscribe할 때마다, 새로운 Observable 시퀀스가 생성된다는 것이다. 예를 들어, 아래 코드를 실행한다고 생각해보자.let results = query.rx.text .flatMapLatest { query innetworkRequestAPI(query)} results.subscribe(...) // a network request results.subscribe(...) // another network request results는 API Request를 발생시키는 Observable이다.이를 두번 subscribe하고 있으니, API R..
-
RxSwift - materialize, dematerialize에 대해서 알아보자.Ray Wenderlich/RxSwift 2018. 6. 13. 23:45
Observing events p.151 - p155 flatMap(링크), flatMapLatest(링크)에서 이어지는 포스트입니다. 도입부 해석을 잘 못하겠음.. 원문 첨부하고 코드로 이해하기. There may be times when you want to convert an observable into an observable of its events. One typical scenario where this is useful is when you do not have control over an observable that has observable properties, and you want to handle error events to avoid terminating outer sequenc..