jinios / swift-cardgameapp

솔리테어 카드게임앱 - 코드스쿼드 미션 (2018.04 - 2018.05)
0 stars 0 forks source link

Step5 Feedback #43

Open jinios opened 6 years ago

jinios commented 6 years ago

Step5 피드백 내용 정리

jinios commented 6 years ago

Stackable 프로토콜 추상화

func stackUp(newCard: Card?, newCards: [Card]?, column: Int) {
        guard let card = newCard else {return}
        foundations[column].push(newCard: card)
    }
jinios commented 6 years ago

FrameCalculator

 func cardIndexInStack(originY: CGFloat) -> Int {
        return Int(originY / 15.0)
 }
jinios commented 6 years ago

Animation에 easing 적용

참고링크- A look at UIView Animation Curves

jinios commented 6 years ago

프로토콜 선언

Question:

Answer:

jinios commented 6 years ago

PanGesture state - .cancelled

 @objc func dragAction(notification: Notification) {
         ...
        switch recognizer.state {
        case .began:
            // do something
        case .changed:
            // do something
        case .ended:
            // do something
        case .cancelled: return
        default: return
        }
    }
jinios commented 6 years ago

옵셔널 처리

func cardImages(at: Int?) -> [CardImageView]? {
        var result = [CardImageView]()
        guard self.subviews.count == self.stackManager.countOfCard() else { return result }
        guard let index = at else { return result }
        guard index != self.subviews.count else { return [lastCardView!] }
        for i in index..<self.stackManager.countOfCard() {
            result.append(self.subviews[i] as! CardImageView)
        }
        return result
    }