Skip to content

Commit 7891e34

Browse files
committed
Create new view controller to hold the new AnimatedCardsView component.
1 parent 9e44892 commit 7891e34

File tree

4 files changed

+171
-1
lines changed

4 files changed

+171
-1
lines changed

CardAnimation.xcodeproj/project.pbxproj

+16
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
D21FB6791BCED32B0021B734 /* ComponentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D21FB6781BCED32B0021B734 /* ComponentViewController.swift */; settings = {ASSET_TAGS = (); }; };
11+
D21FB67C1BCED4C20021B734 /* AnimatedCardsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D21FB67B1BCED4C20021B734 /* AnimatedCardsView.swift */; settings = {ASSET_TAGS = (); }; };
1012
FDD71FB91BBB360A00E076EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD71FB81BBB360A00E076EE /* AppDelegate.swift */; };
1113
FDD71FBB1BBB360A00E076EE /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD71FBA1BBB360A00E076EE /* ViewController.swift */; };
1214
FDD71FBE1BBB360A00E076EE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FDD71FBC1BBB360A00E076EE /* Main.storyboard */; };
@@ -43,6 +45,8 @@
4345
/* End PBXContainerItemProxy section */
4446

4547
/* Begin PBXFileReference section */
48+
D21FB6781BCED32B0021B734 /* ComponentViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ComponentViewController.swift; sourceTree = "<group>"; };
49+
D21FB67B1BCED4C20021B734 /* AnimatedCardsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AnimatedCardsView.swift; path = AnimatedCardView/AnimatedCardsView.swift; sourceTree = "<group>"; };
4650
FDD71FB51BBB360A00E076EE /* CardAnimation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CardAnimation.app; sourceTree = BUILT_PRODUCTS_DIR; };
4751
FDD71FB81BBB360A00E076EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
4852
FDD71FBA1BBB360A00E076EE /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
@@ -92,6 +96,14 @@
9296
/* End PBXFrameworksBuildPhase section */
9397

9498
/* Begin PBXGroup section */
99+
D21FB67A1BCED47C0021B734 /* Component */ = {
100+
isa = PBXGroup;
101+
children = (
102+
D21FB67B1BCED4C20021B734 /* AnimatedCardsView.swift */,
103+
);
104+
name = Component;
105+
sourceTree = "<group>";
106+
};
95107
FDD71FAC1BBB360A00E076EE = {
96108
isa = PBXGroup;
97109
children = (
@@ -115,6 +127,7 @@
115127
FDD71FB71BBB360A00E076EE /* CardAnimation */ = {
116128
isa = PBXGroup;
117129
children = (
130+
D21FB67A1BCED47C0021B734 /* Component */,
118131
FDD7201A1BBBF36700E076EE /* aquaman_young_justice_logo_by_kalangozilla.jpg */,
119132
FDD7201B1BBBF36700E076EE /* batman_tim_burton_style_logo_by_kalangozilla.jpg */,
120133
FDD7201C1BBBF36700E076EE /* classic_captain_marvel_jr_logo_by_kalangozilla.jpg */,
@@ -126,6 +139,7 @@
126139
FDD720201BBBF36700E076EE /* wonder_woman_logo_by_kalangozilla.jpg */,
127140
FDD71FB81BBB360A00E076EE /* AppDelegate.swift */,
128141
FDD71FBA1BBB360A00E076EE /* ViewController.swift */,
142+
D21FB6781BCED32B0021B734 /* ComponentViewController.swift */,
129143
FDD71FBC1BBB360A00E076EE /* Main.storyboard */,
130144
FDD71FBF1BBB360A00E076EE /* Assets.xcassets */,
131145
FDD71FC11BBB360A00E076EE /* LaunchScreen.storyboard */,
@@ -292,7 +306,9 @@
292306
buildActionMask = 2147483647;
293307
files = (
294308
FDD71FBB1BBB360A00E076EE /* ViewController.swift in Sources */,
309+
D21FB67C1BCED4C20021B734 /* AnimatedCardsView.swift in Sources */,
295310
FDD71FB91BBB360A00E076EE /* AppDelegate.swift in Sources */,
311+
D21FB6791BCED32B0021B734 /* ComponentViewController.swift in Sources */,
296312
);
297313
runOnlyForDeploymentPostprocessing = 0;
298314
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//
2+
// AnimatedCardsView.swift
3+
// CardAnimation
4+
//
5+
// Created by Luis Sanchez Garcia on 14/10/15.
6+
// Copyright © 2015 seedante. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
public class AnimatedCardsView: UIView {
12+
13+
private var cardArray : [UIView]!
14+
15+
public struct Constants {
16+
struct DefaultSize {
17+
let width = 400
18+
let height = 300
19+
}
20+
}
21+
22+
/*
23+
// Only override drawRect: if you perform custom drawing.
24+
// An empty implementation adversely affects performance during animation.
25+
override func drawRect(rect: CGRect) {
26+
// Drawing code
27+
}
28+
*/
29+
override init(frame: CGRect) {
30+
cardArray = []
31+
super.init(frame: frame)
32+
}
33+
34+
required public init?(coder aDecoder: NSCoder) {
35+
cardArray = []
36+
super.init(coder: aDecoder)
37+
self.backgroundColor = UIColor.yellowColor()
38+
}
39+
40+
41+
// MARK: Private stuff
42+
43+
func generateCards() {
44+
45+
}
46+
47+
}

CardAnimation/Base.lproj/Main.storyboard

+66-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
33
<dependencies>
44
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
55
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
6+
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
67
</dependencies>
78
<scenes>
89
<!--View Controller-->
@@ -219,6 +220,13 @@
219220
<rect key="frame" x="100" y="250" width="400" height="300"/>
220221
</variation>
221222
</view>
223+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="duM-30-kXn">
224+
<rect key="frame" x="499" y="28" width="81" height="30"/>
225+
<state key="normal" title="Component"/>
226+
<connections>
227+
<segue destination="fw9-rg-tLH" kind="presentation" id="u46-CM-cgV"/>
228+
</connections>
229+
</button>
222230
</subviews>
223231
<animations/>
224232
<constraints>
@@ -227,6 +235,7 @@
227235
<constraint firstItem="zGD-CO-SAA" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="2ab-CE-y4a"/>
228236
<constraint firstItem="fCC-bM-0gK" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" identifier="FrontView" id="E7E-Qb-Vsn"/>
229237
<constraint firstItem="N7c-Er-ecK" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="ESB-M0-wlr"/>
238+
<constraint firstAttribute="trailingMargin" secondItem="duM-30-kXn" secondAttribute="trailing" id="J0J-4S-qRd"/>
230239
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="t6u-vc-eCu" secondAttribute="bottom" constant="20" id="Kia-Qh-Z5X">
231240
<variation key="heightClass=compact" constant="8"/>
232241
<variation key="heightClass=compact-widthClass=regular" constant="176"/>
@@ -247,6 +256,7 @@
247256
<constraint firstItem="oJ8-qS-ALn" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="hl6-w0-Wam"/>
248257
<constraint firstItem="cFT-Mn-coC" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="p8F-fy-InF"/>
249258
<constraint firstItem="dX0-CZ-EP9" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" id="pSj-6z-cTn"/>
259+
<constraint firstItem="duM-30-kXn" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="8" id="skW-8g-LSS"/>
250260
<constraint firstItem="fVC-76-ely" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="w8H-xd-W3D"/>
251261
<constraint firstItem="5cq-ZV-bhK" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="wgJ-ZT-EoV"/>
252262
</constraints>
@@ -261,6 +271,61 @@
261271
</objects>
262272
<point key="canvasLocation" x="61" y="320"/>
263273
</scene>
274+
<!--Component View Controller-->
275+
<scene sceneID="PBh-2T-O7K">
276+
<objects>
277+
<viewController id="fw9-rg-tLH" customClass="ComponentViewController" customModule="CardAnimation" customModuleProvider="target" sceneMemberID="viewController">
278+
<layoutGuides>
279+
<viewControllerLayoutGuide type="top" id="vLI-t1-AxW"/>
280+
<viewControllerLayoutGuide type="bottom" id="QO0-0n-sl7"/>
281+
</layoutGuides>
282+
<view key="view" contentMode="scaleToFill" id="DF4-xn-P6z">
283+
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
284+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
285+
<subviews>
286+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="srb-xo-nyT">
287+
<rect key="frame" x="284" y="28" width="33" height="42"/>
288+
<fontDescription key="fontDescription" type="system" pointSize="25"/>
289+
<state key="normal" title="UP"/>
290+
<connections>
291+
<action selector="onUpPushed:" destination="fw9-rg-tLH" eventType="touchUpInside" id="l3T-kS-9Iq"/>
292+
</connections>
293+
</button>
294+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="31I-9l-4R6">
295+
<rect key="frame" x="262" y="531" width="77" height="42"/>
296+
<fontDescription key="fontDescription" type="system" pointSize="25"/>
297+
<state key="normal" title="DOWN"/>
298+
<connections>
299+
<action selector="onDownPushed:" destination="fw9-rg-tLH" eventType="touchUpInside" id="uS1-jp-980"/>
300+
</connections>
301+
</button>
302+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kKf-Oi-6h7" customClass="AnimatedCardsView" customModule="CardAnimation" customModuleProvider="target">
303+
<rect key="frame" x="20" y="78" width="560" height="445"/>
304+
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
305+
</view>
306+
</subviews>
307+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
308+
<constraints>
309+
<constraint firstAttribute="leadingMargin" secondItem="kKf-Oi-6h7" secondAttribute="leading" id="0s0-6z-zcR"/>
310+
<constraint firstItem="31I-9l-4R6" firstAttribute="top" secondItem="kKf-Oi-6h7" secondAttribute="bottom" constant="8" id="3yB-HY-hYD"/>
311+
<constraint firstItem="srb-xo-nyT" firstAttribute="centerX" secondItem="DF4-xn-P6z" secondAttribute="centerX" id="5M3-xK-26v"/>
312+
<constraint firstAttribute="trailingMargin" secondItem="kKf-Oi-6h7" secondAttribute="trailing" id="6fd-zj-Z4m"/>
313+
<constraint firstItem="kKf-Oi-6h7" firstAttribute="top" secondItem="srb-xo-nyT" secondAttribute="bottom" constant="8" id="F9y-3Q-b2c"/>
314+
<constraint firstItem="QO0-0n-sl7" firstAttribute="top" secondItem="31I-9l-4R6" secondAttribute="bottom" constant="27" id="SCM-te-fwb"/>
315+
<constraint firstItem="kKf-Oi-6h7" firstAttribute="centerY" secondItem="DF4-xn-P6z" secondAttribute="centerY" id="Yos-l1-yKM"/>
316+
<constraint firstItem="kKf-Oi-6h7" firstAttribute="centerX" secondItem="DF4-xn-P6z" secondAttribute="centerX" id="tPw-bD-WOQ"/>
317+
<constraint firstItem="srb-xo-nyT" firstAttribute="top" secondItem="vLI-t1-AxW" secondAttribute="bottom" constant="8" id="u3y-pB-szd"/>
318+
<constraint firstItem="31I-9l-4R6" firstAttribute="centerX" secondItem="DF4-xn-P6z" secondAttribute="centerX" id="up0-y4-wzT"/>
319+
</constraints>
320+
</view>
321+
<connections>
322+
<outlet property="cardsView" destination="kKf-Oi-6h7" id="3qI-Zm-ZrJ"/>
323+
</connections>
324+
</viewController>
325+
<placeholder placeholderIdentifier="IBFirstResponder" id="KqM-81-h7O" userLabel="First Responder" sceneMemberID="firstResponder"/>
326+
</objects>
327+
<point key="canvasLocation" x="769" y="320"/>
328+
</scene>
264329
</scenes>
265330
<resources>
266331
<image name="JLAFRICA.jpeg" width="840" height="328"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//
2+
// ComponentViewController.swift
3+
// CardAnimation
4+
//
5+
// Created by Luis Sanchez Garcia on 14/10/15.
6+
// Copyright © 2015 seedante. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class ComponentViewController: UIViewController {
12+
13+
@IBOutlet weak var cardsView: AnimatedCardsView!
14+
15+
override func viewDidLoad() {
16+
super.viewDidLoad()
17+
18+
// Do any additional setup after loading the view.
19+
}
20+
21+
override func didReceiveMemoryWarning() {
22+
super.didReceiveMemoryWarning()
23+
// Dispose of any resources that can be recreated.
24+
}
25+
26+
27+
/*
28+
// MARK: - Navigation
29+
30+
// In a storyboard-based application, you will often want to do a little preparation before navigation
31+
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
32+
// Get the new view controller using segue.destinationViewController.
33+
// Pass the selected object to the new view controller.
34+
}
35+
*/
36+
@IBAction func onUpPushed(sender: UIButton) {
37+
}
38+
39+
@IBAction func onDownPushed(sender: UIButton) {
40+
}
41+
42+
}

0 commit comments

Comments
 (0)