From 414db398325456cf201b55c546318e02e6abc600 Mon Sep 17 00:00:00 2001 From: Mijin Jeon Date: Mon, 14 May 2018 14:17:19 +0900 Subject: [PATCH] Refactor: Rename methods in view classes #26 --- .../CardGameApp/View/CardDeckView.swift | 15 ++++---- .../CardGameApp/View/CardStacksView.swift | 14 +++---- .../CardGameApp/View/FoundationView.swift | 10 ++--- CardGameApp/CardGameApp/ViewController.swift | 38 +++++++++---------- 4 files changed, 38 insertions(+), 39 deletions(-) diff --git a/CardGameApp/CardGameApp/View/CardDeckView.swift b/CardGameApp/CardGameApp/View/CardDeckView.swift index 132cee32..1ad94018 100644 --- a/CardGameApp/CardGameApp/View/CardDeckView.swift +++ b/CardGameApp/CardGameApp/View/CardDeckView.swift @@ -30,7 +30,7 @@ class CardDeckView: UIView { self.deckManager = gameManager.getDeckDelegate() } - func drawDefault() { + func setup() { let newOrigin = CGPoint(x: PositionX.seventh.value, y: PositionY.upper.value) let frameForDraw = CGRect(origin: newOrigin, size: ViewController.cardSize) self.closedCardDeck = CardImageView(frame: frameForDraw) @@ -57,7 +57,7 @@ class CardDeckView: UIView { } } - func drawOpenDeck() { + func setOpenDeck() { let newOrigin = CGPoint(x: PositionX.sixth.value, y: PositionY.upper.value) let frameForDraw = CGRect(origin: newOrigin, size: ViewController.cardSize) @@ -69,7 +69,7 @@ class CardDeckView: UIView { addSubview(pickedCardView) } - func drawRefresh() { + func loadRefreshIcon() { closedCardDeck.getRefreshImage() } @@ -86,11 +86,10 @@ class CardDeckView: UIView { } } - func redraw() { - // after double tapped? + func reload() { self.subviews.forEach{ $0.removeFromSuperview() } - drawDefault() - drawOpenDeck() + setup() + setOpenDeck() } func movableCardView() -> CardImageView { @@ -100,7 +99,7 @@ class CardDeckView: UIView { func resetByShake() { self.subviews.forEach{ $0.removeFromSuperview() } - drawDefault() + setup() } } diff --git a/CardGameApp/CardGameApp/View/CardStacksView.swift b/CardGameApp/CardGameApp/View/CardStacksView.swift index fcba30f2..d8f771a0 100644 --- a/CardGameApp/CardGameApp/View/CardStacksView.swift +++ b/CardGameApp/CardGameApp/View/CardStacksView.swift @@ -28,16 +28,16 @@ class CardStacksView: UIView { super.init(coder: aDecoder) } - func newDraw() { + func setup() { for i in 0...6 { oneStackViews.append(OneStack(column: i, manager: wholeStackManager)) addSubview(oneStackViews[i]) - oneStackViews[i].newDrawCards() + oneStackViews[i].setup() } } - func redraw(column: Int) { - oneStackViews[column].redraw() + func reload(column: Int) { + oneStackViews[column].reload() } func getOneStack(of column: Int) -> OneStack{ @@ -73,7 +73,7 @@ class OneStack: UIView { fatalError("init(coder:) has not been implemented") } - func newDrawCards() { + func setup() { for i in 0..