├── .gitignore
├── LICENSE
├── NTCustomWaterfallViewCellTests
├── Info.plist
└── NTCustomWaterfallViewCellTests.swift
├── PinterestSwift.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── xcuserdata
│ ├── calissendorff.xcuserdatad
│ └── xcschemes
│ │ ├── PinterestSwift.xcscheme
│ │ └── xcschememanagement.plist
│ ├── demon.xcuserdatad
│ └── xcschemes
│ │ ├── PinterestSwift.xcscheme
│ │ └── xcschememanagement.plist
│ └── richardadem.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
├── PinterestSwift
├── AppDelegate.swift
├── Base.lproj
│ └── Main.storyboard
├── CHTCollectionViewWaterfallLayout.swift
├── Extension.swift
├── Images.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ └── LaunchImage.launchimage
│ │ ├── Contents.json
│ │ ├── retina4.png
│ │ ├── retina47.png
│ │ └── retina55.png
├── Info.plist
├── Macro.swift
├── NTHorizontalPageViewCell.swift
├── NTHorizontalPageViewController.swift
├── NTNavigationController.swift
├── NTTransition.swift
├── NTTransitionProtocol.swift
├── NTWaterfallViewCell.swift
├── NTWaterfallViewController.swift
├── PinterestSwift-Bridging-Header.h
└── images
│ ├── 0.jpg
│ ├── 1.jpg
│ ├── 10.jpg
│ ├── 11.jpg
│ ├── 12.jpg
│ ├── 13.jpg
│ ├── 2.jpg
│ ├── 3.jpg
│ ├── 4.jpg
│ ├── 5.jpg
│ ├── 6.jpg
│ ├── 7.jpg
│ ├── 8.jpg
│ └── 9.jpg
├── PinterestSwiftTests
├── Info.plist
└── PinterestSwiftTests.swift
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | *.xccheckout
3 |
4 | *.xcuserstate
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Nicholas Tau
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/NTCustomWaterfallViewCellTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.demon.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/NTCustomWaterfallViewCellTests/NTCustomWaterfallViewCellTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NTCustomWaterfallViewCellTests.swift
3 | // NTCustomWaterfallViewCellTests
4 | //
5 | // Created by Nicholas Tau on 7/1/14.
6 | // Copyright (c) 2014 Nicholas Tau. All rights reserved.
7 | //
8 |
9 | import XCTest
10 |
11 | class NTCustomWaterfallViewCellTests: XCTestCase {
12 |
13 | override func setUp() {
14 | super.setUp()
15 | // Put setup code here. This method is called before the invocation of each test method in the class.
16 | }
17 |
18 | override func tearDown() {
19 | // Put teardown code here. This method is called after the invocation of each test method in the class.
20 | super.tearDown()
21 | }
22 |
23 | func testExample() {
24 | // This is an example of a functional test case.
25 | XCTAssert(true, "Pass")
26 | }
27 |
28 | func testPerformanceExample() {
29 | // This is an example of a performance test case.
30 | self.measureBlock() {
31 | // Put the code you want to measure the time of here.
32 | }
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/PinterestSwift.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 6419AE721961329B00FBEF0D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6419AE711961329B00FBEF0D /* AppDelegate.swift */; };
11 | 6419AE741961329B00FBEF0D /* NTWaterfallViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6419AE731961329B00FBEF0D /* NTWaterfallViewController.swift */; };
12 | 6419AE771961329B00FBEF0D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6419AE751961329B00FBEF0D /* Main.storyboard */; };
13 | 6419AE791961329B00FBEF0D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6419AE781961329B00FBEF0D /* Images.xcassets */; };
14 | 6419AE851961329B00FBEF0D /* PinterestSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6419AE841961329B00FBEF0D /* PinterestSwiftTests.swift */; };
15 | 6419AE901961386700FBEF0D /* NTWaterfallViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6419AE8F1961386700FBEF0D /* NTWaterfallViewCell.swift */; };
16 | 6419AE9919613E7F00FBEF0D /* CHTCollectionViewWaterfallLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6419AE9819613E7F00FBEF0D /* CHTCollectionViewWaterfallLayout.swift */; };
17 | 64476DB719629BAA000B6F19 /* 0.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DA919629BAA000B6F19 /* 0.jpg */; };
18 | 64476DB819629BAA000B6F19 /* 1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DAA19629BAA000B6F19 /* 1.jpg */; };
19 | 64476DB919629BAA000B6F19 /* 10.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DAB19629BAA000B6F19 /* 10.jpg */; };
20 | 64476DBA19629BAA000B6F19 /* 11.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DAC19629BAA000B6F19 /* 11.jpg */; };
21 | 64476DBB19629BAA000B6F19 /* 12.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DAD19629BAA000B6F19 /* 12.jpg */; };
22 | 64476DBC19629BAA000B6F19 /* 13.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DAE19629BAA000B6F19 /* 13.jpg */; };
23 | 64476DBD19629BAA000B6F19 /* 2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DAF19629BAA000B6F19 /* 2.jpg */; };
24 | 64476DBE19629BAA000B6F19 /* 3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DB019629BAA000B6F19 /* 3.jpg */; };
25 | 64476DBF19629BAA000B6F19 /* 4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DB119629BAA000B6F19 /* 4.jpg */; };
26 | 64476DC019629BAA000B6F19 /* 5.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DB219629BAA000B6F19 /* 5.jpg */; };
27 | 64476DC119629BAA000B6F19 /* 6.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DB319629BAA000B6F19 /* 6.jpg */; };
28 | 64476DC219629BAA000B6F19 /* 7.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DB419629BAA000B6F19 /* 7.jpg */; };
29 | 64476DC319629BAA000B6F19 /* 8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DB519629BAA000B6F19 /* 8.jpg */; };
30 | 64476DC419629BAA000B6F19 /* 9.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 64476DB619629BAA000B6F19 /* 9.jpg */; };
31 | 64476DEB1962A1D2000B6F19 /* NTHorizontalPageViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64476DEA1962A1D2000B6F19 /* NTHorizontalPageViewCell.swift */; };
32 | 64476DED1962A258000B6F19 /* NTHorizontalPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64476DEC1962A258000B6F19 /* NTHorizontalPageViewController.swift */; };
33 | 64476DEF1962BD97000B6F19 /* Macro.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64476DEE1962BD97000B6F19 /* Macro.swift */; };
34 | 64476DF21963AAE1000B6F19 /* NTTransitionProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64476DF11963AAE1000B6F19 /* NTTransitionProtocol.swift */; };
35 | 64476DF71963B633000B6F19 /* Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64476DF61963B633000B6F19 /* Extension.swift */; };
36 | 6471FF721963BAE9006A0827 /* NTTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6471FF711963BAE9006A0827 /* NTTransition.swift */; };
37 | 64E88A2F196419D300D982B3 /* NTNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64E88A2E196419D300D982B3 /* NTNavigationController.swift */; };
38 | /* End PBXBuildFile section */
39 |
40 | /* Begin PBXContainerItemProxy section */
41 | 6419AE7F1961329B00FBEF0D /* PBXContainerItemProxy */ = {
42 | isa = PBXContainerItemProxy;
43 | containerPortal = 6419AE641961329B00FBEF0D /* Project object */;
44 | proxyType = 1;
45 | remoteGlobalIDString = 6419AE6B1961329B00FBEF0D;
46 | remoteInfo = PinterestSwift;
47 | };
48 | /* End PBXContainerItemProxy section */
49 |
50 | /* Begin PBXCopyFilesBuildPhase section */
51 | 64476DE619629C69000B6F19 /* Embed Frameworks */ = {
52 | isa = PBXCopyFilesBuildPhase;
53 | buildActionMask = 2147483647;
54 | dstPath = "";
55 | dstSubfolderSpec = 10;
56 | files = (
57 | );
58 | name = "Embed Frameworks";
59 | runOnlyForDeploymentPostprocessing = 0;
60 | };
61 | /* End PBXCopyFilesBuildPhase section */
62 |
63 | /* Begin PBXFileReference section */
64 | 6419AE6C1961329B00FBEF0D /* PinterestSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PinterestSwift.app; sourceTree = BUILT_PRODUCTS_DIR; };
65 | 6419AE701961329B00FBEF0D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
66 | 6419AE711961329B00FBEF0D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
67 | 6419AE731961329B00FBEF0D /* NTWaterfallViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NTWaterfallViewController.swift; sourceTree = ""; };
68 | 6419AE761961329B00FBEF0D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
69 | 6419AE781961329B00FBEF0D /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
70 | 6419AE7E1961329B00FBEF0D /* PinterestSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PinterestSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
71 | 6419AE831961329B00FBEF0D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
72 | 6419AE841961329B00FBEF0D /* PinterestSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinterestSwiftTests.swift; sourceTree = ""; };
73 | 6419AE8F1961386700FBEF0D /* NTWaterfallViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NTWaterfallViewCell.swift; sourceTree = ""; };
74 | 6419AE9819613E7F00FBEF0D /* CHTCollectionViewWaterfallLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CHTCollectionViewWaterfallLayout.swift; sourceTree = ""; };
75 | 64476DA919629BAA000B6F19 /* 0.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 0.jpg; sourceTree = ""; };
76 | 64476DAA19629BAA000B6F19 /* 1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1.jpg; sourceTree = ""; };
77 | 64476DAB19629BAA000B6F19 /* 10.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 10.jpg; sourceTree = ""; };
78 | 64476DAC19629BAA000B6F19 /* 11.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 11.jpg; sourceTree = ""; };
79 | 64476DAD19629BAA000B6F19 /* 12.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 12.jpg; sourceTree = ""; };
80 | 64476DAE19629BAA000B6F19 /* 13.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 13.jpg; sourceTree = ""; };
81 | 64476DAF19629BAA000B6F19 /* 2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 2.jpg; sourceTree = ""; };
82 | 64476DB019629BAA000B6F19 /* 3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 3.jpg; sourceTree = ""; };
83 | 64476DB119629BAA000B6F19 /* 4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 4.jpg; sourceTree = ""; };
84 | 64476DB219629BAA000B6F19 /* 5.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 5.jpg; sourceTree = ""; };
85 | 64476DB319629BAA000B6F19 /* 6.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 6.jpg; sourceTree = ""; };
86 | 64476DB419629BAA000B6F19 /* 7.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 7.jpg; sourceTree = ""; };
87 | 64476DB519629BAA000B6F19 /* 8.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 8.jpg; sourceTree = ""; };
88 | 64476DB619629BAA000B6F19 /* 9.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 9.jpg; sourceTree = ""; };
89 | 64476DDA19629C69000B6F19 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
90 | 64476DDB19629C69000B6F19 /* NTCustomWaterfallViewCellTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NTCustomWaterfallViewCellTests.swift; sourceTree = ""; };
91 | 64476DEA1962A1D2000B6F19 /* NTHorizontalPageViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NTHorizontalPageViewCell.swift; sourceTree = ""; };
92 | 64476DEC1962A258000B6F19 /* NTHorizontalPageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NTHorizontalPageViewController.swift; sourceTree = ""; };
93 | 64476DEE1962BD97000B6F19 /* Macro.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Macro.swift; sourceTree = ""; };
94 | 64476DF11963AAE1000B6F19 /* NTTransitionProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NTTransitionProtocol.swift; sourceTree = ""; };
95 | 64476DF61963B633000B6F19 /* Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extension.swift; sourceTree = ""; };
96 | 6471FF711963BAE9006A0827 /* NTTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NTTransition.swift; sourceTree = ""; };
97 | 64E88A2E196419D300D982B3 /* NTNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NTNavigationController.swift; sourceTree = ""; };
98 | /* End PBXFileReference section */
99 |
100 | /* Begin PBXFrameworksBuildPhase section */
101 | 6419AE691961329B00FBEF0D /* Frameworks */ = {
102 | isa = PBXFrameworksBuildPhase;
103 | buildActionMask = 2147483647;
104 | files = (
105 | );
106 | runOnlyForDeploymentPostprocessing = 0;
107 | };
108 | 6419AE7B1961329B00FBEF0D /* Frameworks */ = {
109 | isa = PBXFrameworksBuildPhase;
110 | buildActionMask = 2147483647;
111 | files = (
112 | );
113 | runOnlyForDeploymentPostprocessing = 0;
114 | };
115 | /* End PBXFrameworksBuildPhase section */
116 |
117 | /* Begin PBXGroup section */
118 | 6419AE631961329B00FBEF0D = {
119 | isa = PBXGroup;
120 | children = (
121 | 6419AE6E1961329B00FBEF0D /* PinterestSwift */,
122 | 6419AE811961329B00FBEF0D /* PinterestSwiftTests */,
123 | 64476DD819629C69000B6F19 /* NTCustomWaterfallViewCellTests */,
124 | 6419AE6D1961329B00FBEF0D /* Products */,
125 | );
126 | sourceTree = "";
127 | };
128 | 6419AE6D1961329B00FBEF0D /* Products */ = {
129 | isa = PBXGroup;
130 | children = (
131 | 6419AE6C1961329B00FBEF0D /* PinterestSwift.app */,
132 | 6419AE7E1961329B00FBEF0D /* PinterestSwiftTests.xctest */,
133 | );
134 | name = Products;
135 | sourceTree = "";
136 | };
137 | 6419AE6E1961329B00FBEF0D /* PinterestSwift */ = {
138 | isa = PBXGroup;
139 | children = (
140 | 64482A741964EA9A005D3D93 /* Layout */,
141 | 64482A731964EA8C005D3D93 /* ViewControllers */,
142 | 64E88A2D1963F1B000D982B3 /* Extensions */,
143 | 64476DF31963AE86000B6F19 /* Transition */,
144 | 64476DA519617822000B6F19 /* Utils */,
145 | 6419AE8E1961384700FBEF0D /* Views */,
146 | 6419AE711961329B00FBEF0D /* AppDelegate.swift */,
147 | 6419AE751961329B00FBEF0D /* Main.storyboard */,
148 | 64476DA819629BAA000B6F19 /* images */,
149 | 6419AE781961329B00FBEF0D /* Images.xcassets */,
150 | 6419AE6F1961329B00FBEF0D /* Supporting Files */,
151 | );
152 | path = PinterestSwift;
153 | sourceTree = "";
154 | };
155 | 6419AE6F1961329B00FBEF0D /* Supporting Files */ = {
156 | isa = PBXGroup;
157 | children = (
158 | 6419AE701961329B00FBEF0D /* Info.plist */,
159 | );
160 | name = "Supporting Files";
161 | sourceTree = "";
162 | };
163 | 6419AE811961329B00FBEF0D /* PinterestSwiftTests */ = {
164 | isa = PBXGroup;
165 | children = (
166 | 6419AE841961329B00FBEF0D /* PinterestSwiftTests.swift */,
167 | 6419AE821961329B00FBEF0D /* Supporting Files */,
168 | );
169 | path = PinterestSwiftTests;
170 | sourceTree = "";
171 | };
172 | 6419AE821961329B00FBEF0D /* Supporting Files */ = {
173 | isa = PBXGroup;
174 | children = (
175 | 6419AE831961329B00FBEF0D /* Info.plist */,
176 | );
177 | name = "Supporting Files";
178 | sourceTree = "";
179 | };
180 | 6419AE8E1961384700FBEF0D /* Views */ = {
181 | isa = PBXGroup;
182 | children = (
183 | 6419AE8F1961386700FBEF0D /* NTWaterfallViewCell.swift */,
184 | 64476DEA1962A1D2000B6F19 /* NTHorizontalPageViewCell.swift */,
185 | );
186 | name = Views;
187 | sourceTree = "";
188 | };
189 | 64476DA519617822000B6F19 /* Utils */ = {
190 | isa = PBXGroup;
191 | children = (
192 | 64476DEE1962BD97000B6F19 /* Macro.swift */,
193 | );
194 | name = Utils;
195 | sourceTree = "";
196 | };
197 | 64476DA819629BAA000B6F19 /* images */ = {
198 | isa = PBXGroup;
199 | children = (
200 | 64476DA919629BAA000B6F19 /* 0.jpg */,
201 | 64476DAA19629BAA000B6F19 /* 1.jpg */,
202 | 64476DAB19629BAA000B6F19 /* 10.jpg */,
203 | 64476DAC19629BAA000B6F19 /* 11.jpg */,
204 | 64476DAD19629BAA000B6F19 /* 12.jpg */,
205 | 64476DAE19629BAA000B6F19 /* 13.jpg */,
206 | 64476DAF19629BAA000B6F19 /* 2.jpg */,
207 | 64476DB019629BAA000B6F19 /* 3.jpg */,
208 | 64476DB119629BAA000B6F19 /* 4.jpg */,
209 | 64476DB219629BAA000B6F19 /* 5.jpg */,
210 | 64476DB319629BAA000B6F19 /* 6.jpg */,
211 | 64476DB419629BAA000B6F19 /* 7.jpg */,
212 | 64476DB519629BAA000B6F19 /* 8.jpg */,
213 | 64476DB619629BAA000B6F19 /* 9.jpg */,
214 | );
215 | path = images;
216 | sourceTree = "";
217 | };
218 | 64476DD819629C69000B6F19 /* NTCustomWaterfallViewCellTests */ = {
219 | isa = PBXGroup;
220 | children = (
221 | 64476DDB19629C69000B6F19 /* NTCustomWaterfallViewCellTests.swift */,
222 | 64476DD919629C69000B6F19 /* Supporting Files */,
223 | );
224 | path = NTCustomWaterfallViewCellTests;
225 | sourceTree = "";
226 | };
227 | 64476DD919629C69000B6F19 /* Supporting Files */ = {
228 | isa = PBXGroup;
229 | children = (
230 | 64476DDA19629C69000B6F19 /* Info.plist */,
231 | );
232 | name = "Supporting Files";
233 | sourceTree = "";
234 | };
235 | 64476DF01963AA8E000B6F19 /* Protocol */ = {
236 | isa = PBXGroup;
237 | children = (
238 | 64476DF11963AAE1000B6F19 /* NTTransitionProtocol.swift */,
239 | );
240 | name = Protocol;
241 | sourceTree = "";
242 | };
243 | 64476DF31963AE86000B6F19 /* Transition */ = {
244 | isa = PBXGroup;
245 | children = (
246 | 6471FF711963BAE9006A0827 /* NTTransition.swift */,
247 | 64476DF01963AA8E000B6F19 /* Protocol */,
248 | );
249 | name = Transition;
250 | sourceTree = "";
251 | };
252 | 64482A731964EA8C005D3D93 /* ViewControllers */ = {
253 | isa = PBXGroup;
254 | children = (
255 | 6419AE731961329B00FBEF0D /* NTWaterfallViewController.swift */,
256 | 64E88A2E196419D300D982B3 /* NTNavigationController.swift */,
257 | 64476DEC1962A258000B6F19 /* NTHorizontalPageViewController.swift */,
258 | );
259 | name = ViewControllers;
260 | sourceTree = "";
261 | };
262 | 64482A741964EA9A005D3D93 /* Layout */ = {
263 | isa = PBXGroup;
264 | children = (
265 | 6419AE9819613E7F00FBEF0D /* CHTCollectionViewWaterfallLayout.swift */,
266 | );
267 | name = Layout;
268 | sourceTree = "";
269 | };
270 | 64E88A2D1963F1B000D982B3 /* Extensions */ = {
271 | isa = PBXGroup;
272 | children = (
273 | 64476DF61963B633000B6F19 /* Extension.swift */,
274 | );
275 | name = Extensions;
276 | sourceTree = "";
277 | };
278 | /* End PBXGroup section */
279 |
280 | /* Begin PBXNativeTarget section */
281 | 6419AE6B1961329B00FBEF0D /* PinterestSwift */ = {
282 | isa = PBXNativeTarget;
283 | buildConfigurationList = 6419AE881961329B00FBEF0D /* Build configuration list for PBXNativeTarget "PinterestSwift" */;
284 | buildPhases = (
285 | 6419AE681961329B00FBEF0D /* Sources */,
286 | 6419AE691961329B00FBEF0D /* Frameworks */,
287 | 6419AE6A1961329B00FBEF0D /* Resources */,
288 | 64476DE619629C69000B6F19 /* Embed Frameworks */,
289 | );
290 | buildRules = (
291 | );
292 | dependencies = (
293 | );
294 | name = PinterestSwift;
295 | productName = PinterestSwift;
296 | productReference = 6419AE6C1961329B00FBEF0D /* PinterestSwift.app */;
297 | productType = "com.apple.product-type.application";
298 | };
299 | 6419AE7D1961329B00FBEF0D /* PinterestSwiftTests */ = {
300 | isa = PBXNativeTarget;
301 | buildConfigurationList = 6419AE8B1961329B00FBEF0D /* Build configuration list for PBXNativeTarget "PinterestSwiftTests" */;
302 | buildPhases = (
303 | 6419AE7A1961329B00FBEF0D /* Sources */,
304 | 6419AE7B1961329B00FBEF0D /* Frameworks */,
305 | 6419AE7C1961329B00FBEF0D /* Resources */,
306 | );
307 | buildRules = (
308 | );
309 | dependencies = (
310 | 6419AE801961329B00FBEF0D /* PBXTargetDependency */,
311 | );
312 | name = PinterestSwiftTests;
313 | productName = PinterestSwiftTests;
314 | productReference = 6419AE7E1961329B00FBEF0D /* PinterestSwiftTests.xctest */;
315 | productType = "com.apple.product-type.bundle.unit-test";
316 | };
317 | /* End PBXNativeTarget section */
318 |
319 | /* Begin PBXProject section */
320 | 6419AE641961329B00FBEF0D /* Project object */ = {
321 | isa = PBXProject;
322 | attributes = {
323 | LastSwiftMigration = 0700;
324 | LastSwiftUpdateCheck = 0700;
325 | LastUpgradeCheck = 0600;
326 | ORGANIZATIONNAME = "Nicholas Tau";
327 | TargetAttributes = {
328 | 6419AE6B1961329B00FBEF0D = {
329 | CreatedOnToolsVersion = 6.0;
330 | LastSwiftMigration = 0810;
331 | };
332 | 6419AE7D1961329B00FBEF0D = {
333 | CreatedOnToolsVersion = 6.0;
334 | LastSwiftMigration = 0810;
335 | TestTargetID = 6419AE6B1961329B00FBEF0D;
336 | };
337 | };
338 | };
339 | buildConfigurationList = 6419AE671961329B00FBEF0D /* Build configuration list for PBXProject "PinterestSwift" */;
340 | compatibilityVersion = "Xcode 3.2";
341 | developmentRegion = English;
342 | hasScannedForEncodings = 0;
343 | knownRegions = (
344 | English,
345 | en,
346 | Base,
347 | );
348 | mainGroup = 6419AE631961329B00FBEF0D;
349 | productRefGroup = 6419AE6D1961329B00FBEF0D /* Products */;
350 | projectDirPath = "";
351 | projectRoot = "";
352 | targets = (
353 | 6419AE6B1961329B00FBEF0D /* PinterestSwift */,
354 | 6419AE7D1961329B00FBEF0D /* PinterestSwiftTests */,
355 | );
356 | };
357 | /* End PBXProject section */
358 |
359 | /* Begin PBXResourcesBuildPhase section */
360 | 6419AE6A1961329B00FBEF0D /* Resources */ = {
361 | isa = PBXResourcesBuildPhase;
362 | buildActionMask = 2147483647;
363 | files = (
364 | 64476DC319629BAA000B6F19 /* 8.jpg in Resources */,
365 | 64476DBF19629BAA000B6F19 /* 4.jpg in Resources */,
366 | 64476DB919629BAA000B6F19 /* 10.jpg in Resources */,
367 | 64476DC119629BAA000B6F19 /* 6.jpg in Resources */,
368 | 64476DC219629BAA000B6F19 /* 7.jpg in Resources */,
369 | 64476DBC19629BAA000B6F19 /* 13.jpg in Resources */,
370 | 64476DB719629BAA000B6F19 /* 0.jpg in Resources */,
371 | 64476DBD19629BAA000B6F19 /* 2.jpg in Resources */,
372 | 64476DBB19629BAA000B6F19 /* 12.jpg in Resources */,
373 | 64476DBE19629BAA000B6F19 /* 3.jpg in Resources */,
374 | 64476DB819629BAA000B6F19 /* 1.jpg in Resources */,
375 | 64476DBA19629BAA000B6F19 /* 11.jpg in Resources */,
376 | 64476DC019629BAA000B6F19 /* 5.jpg in Resources */,
377 | 64476DC419629BAA000B6F19 /* 9.jpg in Resources */,
378 | 6419AE771961329B00FBEF0D /* Main.storyboard in Resources */,
379 | 6419AE791961329B00FBEF0D /* Images.xcassets in Resources */,
380 | );
381 | runOnlyForDeploymentPostprocessing = 0;
382 | };
383 | 6419AE7C1961329B00FBEF0D /* Resources */ = {
384 | isa = PBXResourcesBuildPhase;
385 | buildActionMask = 2147483647;
386 | files = (
387 | );
388 | runOnlyForDeploymentPostprocessing = 0;
389 | };
390 | /* End PBXResourcesBuildPhase section */
391 |
392 | /* Begin PBXSourcesBuildPhase section */
393 | 6419AE681961329B00FBEF0D /* Sources */ = {
394 | isa = PBXSourcesBuildPhase;
395 | buildActionMask = 2147483647;
396 | files = (
397 | 64476DEF1962BD97000B6F19 /* Macro.swift in Sources */,
398 | 6471FF721963BAE9006A0827 /* NTTransition.swift in Sources */,
399 | 6419AE901961386700FBEF0D /* NTWaterfallViewCell.swift in Sources */,
400 | 64476DED1962A258000B6F19 /* NTHorizontalPageViewController.swift in Sources */,
401 | 64E88A2F196419D300D982B3 /* NTNavigationController.swift in Sources */,
402 | 6419AE9919613E7F00FBEF0D /* CHTCollectionViewWaterfallLayout.swift in Sources */,
403 | 64476DEB1962A1D2000B6F19 /* NTHorizontalPageViewCell.swift in Sources */,
404 | 6419AE741961329B00FBEF0D /* NTWaterfallViewController.swift in Sources */,
405 | 6419AE721961329B00FBEF0D /* AppDelegate.swift in Sources */,
406 | 64476DF21963AAE1000B6F19 /* NTTransitionProtocol.swift in Sources */,
407 | 64476DF71963B633000B6F19 /* Extension.swift in Sources */,
408 | );
409 | runOnlyForDeploymentPostprocessing = 0;
410 | };
411 | 6419AE7A1961329B00FBEF0D /* Sources */ = {
412 | isa = PBXSourcesBuildPhase;
413 | buildActionMask = 2147483647;
414 | files = (
415 | 6419AE851961329B00FBEF0D /* PinterestSwiftTests.swift in Sources */,
416 | );
417 | runOnlyForDeploymentPostprocessing = 0;
418 | };
419 | /* End PBXSourcesBuildPhase section */
420 |
421 | /* Begin PBXTargetDependency section */
422 | 6419AE801961329B00FBEF0D /* PBXTargetDependency */ = {
423 | isa = PBXTargetDependency;
424 | target = 6419AE6B1961329B00FBEF0D /* PinterestSwift */;
425 | targetProxy = 6419AE7F1961329B00FBEF0D /* PBXContainerItemProxy */;
426 | };
427 | /* End PBXTargetDependency section */
428 |
429 | /* Begin PBXVariantGroup section */
430 | 6419AE751961329B00FBEF0D /* Main.storyboard */ = {
431 | isa = PBXVariantGroup;
432 | children = (
433 | 6419AE761961329B00FBEF0D /* Base */,
434 | );
435 | name = Main.storyboard;
436 | sourceTree = "";
437 | };
438 | /* End PBXVariantGroup section */
439 |
440 | /* Begin XCBuildConfiguration section */
441 | 6419AE861961329B00FBEF0D /* Debug */ = {
442 | isa = XCBuildConfiguration;
443 | buildSettings = {
444 | ALWAYS_SEARCH_USER_PATHS = NO;
445 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
446 | CLANG_CXX_LIBRARY = "libc++";
447 | CLANG_ENABLE_MODULES = YES;
448 | CLANG_ENABLE_OBJC_ARC = YES;
449 | CLANG_WARN_BOOL_CONVERSION = YES;
450 | CLANG_WARN_CONSTANT_CONVERSION = YES;
451 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
452 | CLANG_WARN_EMPTY_BODY = YES;
453 | CLANG_WARN_ENUM_CONVERSION = YES;
454 | CLANG_WARN_INT_CONVERSION = YES;
455 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
456 | CLANG_WARN_UNREACHABLE_CODE = YES;
457 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
458 | CODE_SIGN_IDENTITY = "iPhone Developer";
459 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
460 | COPY_PHASE_STRIP = NO;
461 | ENABLE_STRICT_OBJC_MSGSEND = YES;
462 | GCC_C_LANGUAGE_STANDARD = gnu99;
463 | GCC_DYNAMIC_NO_PIC = NO;
464 | GCC_OPTIMIZATION_LEVEL = 0;
465 | GCC_PREPROCESSOR_DEFINITIONS = (
466 | "DEBUG=1",
467 | "$(inherited)",
468 | );
469 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
470 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
471 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
472 | GCC_WARN_UNDECLARED_SELECTOR = YES;
473 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
474 | GCC_WARN_UNUSED_FUNCTION = YES;
475 | GCC_WARN_UNUSED_VARIABLE = YES;
476 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
477 | METAL_ENABLE_DEBUG_INFO = YES;
478 | ONLY_ACTIVE_ARCH = YES;
479 | SDKROOT = iphoneos;
480 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
481 | };
482 | name = Debug;
483 | };
484 | 6419AE871961329B00FBEF0D /* Release */ = {
485 | isa = XCBuildConfiguration;
486 | buildSettings = {
487 | ALWAYS_SEARCH_USER_PATHS = NO;
488 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
489 | CLANG_CXX_LIBRARY = "libc++";
490 | CLANG_ENABLE_MODULES = YES;
491 | CLANG_ENABLE_OBJC_ARC = YES;
492 | CLANG_WARN_BOOL_CONVERSION = YES;
493 | CLANG_WARN_CONSTANT_CONVERSION = YES;
494 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
495 | CLANG_WARN_EMPTY_BODY = YES;
496 | CLANG_WARN_ENUM_CONVERSION = YES;
497 | CLANG_WARN_INT_CONVERSION = YES;
498 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
499 | CLANG_WARN_UNREACHABLE_CODE = YES;
500 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
501 | CODE_SIGN_IDENTITY = "iPhone Developer";
502 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
503 | COPY_PHASE_STRIP = YES;
504 | ENABLE_NS_ASSERTIONS = NO;
505 | ENABLE_STRICT_OBJC_MSGSEND = YES;
506 | GCC_C_LANGUAGE_STANDARD = gnu99;
507 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
508 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
509 | GCC_WARN_UNDECLARED_SELECTOR = YES;
510 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
511 | GCC_WARN_UNUSED_FUNCTION = YES;
512 | GCC_WARN_UNUSED_VARIABLE = YES;
513 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
514 | METAL_ENABLE_DEBUG_INFO = NO;
515 | SDKROOT = iphoneos;
516 | VALIDATE_PRODUCT = YES;
517 | };
518 | name = Release;
519 | };
520 | 6419AE891961329B00FBEF0D /* Debug */ = {
521 | isa = XCBuildConfiguration;
522 | buildSettings = {
523 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
524 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
525 | CLANG_ENABLE_MODULES = YES;
526 | INFOPLIST_FILE = PinterestSwift/Info.plist;
527 | IPHONEOS_DEPLOYMENT_TARGET = 13.1;
528 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
529 | PRODUCT_NAME = "$(TARGET_NAME)";
530 | PROVISIONING_PROFILE = "";
531 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
532 | SWIFT_VERSION = 5.0;
533 | };
534 | name = Debug;
535 | };
536 | 6419AE8A1961329B00FBEF0D /* Release */ = {
537 | isa = XCBuildConfiguration;
538 | buildSettings = {
539 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
540 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
541 | CLANG_ENABLE_MODULES = YES;
542 | INFOPLIST_FILE = PinterestSwift/Info.plist;
543 | IPHONEOS_DEPLOYMENT_TARGET = 13.1;
544 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
545 | PRODUCT_NAME = "$(TARGET_NAME)";
546 | PROVISIONING_PROFILE = "";
547 | SWIFT_VERSION = 5.0;
548 | };
549 | name = Release;
550 | };
551 | 6419AE8C1961329B00FBEF0D /* Debug */ = {
552 | isa = XCBuildConfiguration;
553 | buildSettings = {
554 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/PinterestSwift.app/PinterestSwift";
555 | FRAMEWORK_SEARCH_PATHS = (
556 | "$(SDKROOT)/Developer/Library/Frameworks",
557 | "$(inherited)",
558 | );
559 | GCC_PREPROCESSOR_DEFINITIONS = (
560 | "DEBUG=1",
561 | "$(inherited)",
562 | );
563 | INFOPLIST_FILE = PinterestSwiftTests/Info.plist;
564 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
565 | METAL_ENABLE_DEBUG_INFO = YES;
566 | PRODUCT_NAME = "$(TARGET_NAME)";
567 | SWIFT_VERSION = 3.0;
568 | TEST_HOST = "$(BUNDLE_LOADER)";
569 | };
570 | name = Debug;
571 | };
572 | 6419AE8D1961329B00FBEF0D /* Release */ = {
573 | isa = XCBuildConfiguration;
574 | buildSettings = {
575 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/PinterestSwift.app/PinterestSwift";
576 | FRAMEWORK_SEARCH_PATHS = (
577 | "$(SDKROOT)/Developer/Library/Frameworks",
578 | "$(inherited)",
579 | );
580 | INFOPLIST_FILE = PinterestSwiftTests/Info.plist;
581 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
582 | METAL_ENABLE_DEBUG_INFO = NO;
583 | PRODUCT_NAME = "$(TARGET_NAME)";
584 | SWIFT_VERSION = 3.0;
585 | TEST_HOST = "$(BUNDLE_LOADER)";
586 | };
587 | name = Release;
588 | };
589 | /* End XCBuildConfiguration section */
590 |
591 | /* Begin XCConfigurationList section */
592 | 6419AE671961329B00FBEF0D /* Build configuration list for PBXProject "PinterestSwift" */ = {
593 | isa = XCConfigurationList;
594 | buildConfigurations = (
595 | 6419AE861961329B00FBEF0D /* Debug */,
596 | 6419AE871961329B00FBEF0D /* Release */,
597 | );
598 | defaultConfigurationIsVisible = 0;
599 | defaultConfigurationName = Release;
600 | };
601 | 6419AE881961329B00FBEF0D /* Build configuration list for PBXNativeTarget "PinterestSwift" */ = {
602 | isa = XCConfigurationList;
603 | buildConfigurations = (
604 | 6419AE891961329B00FBEF0D /* Debug */,
605 | 6419AE8A1961329B00FBEF0D /* Release */,
606 | );
607 | defaultConfigurationIsVisible = 0;
608 | defaultConfigurationName = Release;
609 | };
610 | 6419AE8B1961329B00FBEF0D /* Build configuration list for PBXNativeTarget "PinterestSwiftTests" */ = {
611 | isa = XCConfigurationList;
612 | buildConfigurations = (
613 | 6419AE8C1961329B00FBEF0D /* Debug */,
614 | 6419AE8D1961329B00FBEF0D /* Release */,
615 | );
616 | defaultConfigurationIsVisible = 0;
617 | defaultConfigurationName = Release;
618 | };
619 | /* End XCConfigurationList section */
620 | };
621 | rootObject = 6419AE641961329B00FBEF0D /* Project object */;
622 | }
623 |
--------------------------------------------------------------------------------
/PinterestSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PinterestSwift.xcodeproj/xcuserdata/calissendorff.xcuserdatad/xcschemes/PinterestSwift.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
77 |
83 |
84 |
85 |
86 |
87 |
88 |
94 |
96 |
102 |
103 |
104 |
105 |
107 |
108 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/PinterestSwift.xcodeproj/xcuserdata/calissendorff.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PinterestSwift.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 6419AE6B1961329B00FBEF0D
16 |
17 | primary
18 |
19 |
20 | 6419AE7D1961329B00FBEF0D
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/PinterestSwift.xcodeproj/xcuserdata/demon.xcuserdatad/xcschemes/PinterestSwift.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/PinterestSwift.xcodeproj/xcuserdata/demon.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PinterestSwift.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 6419AE6B1961329B00FBEF0D
16 |
17 | primary
18 |
19 |
20 | 6419AE7D1961329B00FBEF0D
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/PinterestSwift.xcodeproj/xcuserdata/richardadem.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PinterestSwift.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/PinterestSwift/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // PinterestSwift
4 | //
5 | // Created by Nicholas Tau on 6/30/14.
6 | // Copyright (c) 2014 Nicholas Tau. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | // var navigationContorller = self.window?.rootViewController as UINavigationController
20 | // navigationContorller.setNavigationBarHidden(true, animated: false)
21 | return true
22 | }
23 |
24 | func applicationWillResignActive(_ application: UIApplication) {
25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
26 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
27 | }
28 |
29 | func applicationDidEnterBackground(_ application: UIApplication) {
30 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
31 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
32 | }
33 |
34 | func applicationWillEnterForeground(_ application: UIApplication) {
35 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
36 | }
37 |
38 | func applicationDidBecomeActive(_ application: UIApplication) {
39 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
40 | }
41 |
42 | func applicationWillTerminate(_ application: UIApplication) {
43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
44 | }
45 |
46 |
47 | }
48 |
49 |
--------------------------------------------------------------------------------
/PinterestSwift/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/PinterestSwift/CHTCollectionViewWaterfallLayout.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CHTCollectionViewWaterfallLayout.swift
3 | // PinterestSwift
4 | //
5 | // Created by Nicholas Tau on 6/30/14.
6 | // Copyright (c) 2014 Nicholas Tau. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 | fileprivate func < (lhs: T?, rhs: T?) -> Bool {
12 | switch (lhs, rhs) {
13 | case let (l?, r?):
14 | return l < r
15 | case (nil, _?):
16 | return true
17 | default:
18 | return false
19 | }
20 | }
21 |
22 | fileprivate func > (lhs: T?, rhs: T?) -> Bool {
23 | switch (lhs, rhs) {
24 | case let (l?, r?):
25 | return l > r
26 | default:
27 | return rhs < lhs
28 | }
29 | }
30 |
31 |
32 | @objc protocol CHTCollectionViewDelegateWaterfallLayout: UICollectionViewDelegate{
33 |
34 | func collectionView (_ collectionView: UICollectionView,layout collectionViewLayout: UICollectionViewLayout,
35 | sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize
36 |
37 | @objc optional func colletionView (_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout,
38 | heightForHeaderInSection section: NSInteger) -> CGFloat
39 |
40 | @objc optional func colletionView (_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout,
41 | heightForFooterInSection section: NSInteger) -> CGFloat
42 |
43 | @objc optional func colletionView (_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout,
44 | insetForSectionAtIndex section: NSInteger) -> UIEdgeInsets
45 |
46 | @objc optional func colletionView (_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout,
47 | minimumInteritemSpacingForSectionAtIndex section: NSInteger) -> CGFloat
48 | }
49 |
50 | enum CHTCollectionViewWaterfallLayoutItemRenderDirection : NSInteger{
51 | case shortestFirst
52 | case leftToRight
53 | case rightToLeft
54 | }
55 |
56 | class CHTCollectionViewWaterfallLayout : UICollectionViewLayout{
57 | let CHTCollectionElementKindSectionHeader = "CHTCollectionElementKindSectionHeader"
58 | let CHTCollectionElementKindSectionFooter = "CHTCollectionElementKindSectionFooter"
59 |
60 | var columnCount : NSInteger{
61 | didSet{
62 | invalidateLayout()
63 | }}
64 |
65 | var minimumColumnSpacing : CGFloat{
66 | didSet{
67 | invalidateLayout()
68 | }}
69 |
70 | var minimumInteritemSpacing : CGFloat{
71 | didSet{
72 | invalidateLayout()
73 | }}
74 |
75 | var headerHeight : CGFloat{
76 | didSet{
77 | invalidateLayout()
78 | }}
79 |
80 | var footerHeight : CGFloat{
81 | didSet{
82 | invalidateLayout()
83 | }}
84 |
85 | var sectionInset : UIEdgeInsets{
86 | didSet{
87 | invalidateLayout()
88 | }}
89 |
90 |
91 | var itemRenderDirection : CHTCollectionViewWaterfallLayoutItemRenderDirection{
92 | didSet{
93 | invalidateLayout()
94 | }}
95 |
96 |
97 | // private property and method above.
98 | weak var delegate : CHTCollectionViewDelegateWaterfallLayout?{
99 | get{
100 | return self.collectionView!.delegate as? CHTCollectionViewDelegateWaterfallLayout
101 | }
102 | }
103 | var columnHeights : NSMutableArray
104 | var sectionItemAttributes : NSMutableArray
105 | var allItemAttributes : NSMutableArray
106 | var headersAttributes : NSMutableDictionary
107 | var footersAttributes : NSMutableDictionary
108 | var unionRects : NSMutableArray
109 | let unionSize = 20
110 |
111 | override init(){
112 | self.headerHeight = 0.0
113 | self.footerHeight = 0.0
114 | self.columnCount = 2
115 | self.minimumInteritemSpacing = 10
116 | self.minimumColumnSpacing = 10
117 | self.sectionInset = UIEdgeInsets.zero
118 | self.itemRenderDirection = .shortestFirst
119 |
120 | headersAttributes = NSMutableDictionary()
121 | footersAttributes = NSMutableDictionary()
122 | unionRects = NSMutableArray()
123 | columnHeights = NSMutableArray()
124 | allItemAttributes = NSMutableArray()
125 | sectionItemAttributes = NSMutableArray()
126 |
127 | super.init()
128 | }
129 |
130 | required init?(coder aDecoder: NSCoder) {
131 | fatalError("init(coder:) has not been implemented")
132 | }
133 |
134 | func itemWidthInSectionAtIndex (_ section : NSInteger) -> CGFloat {
135 | let width:CGFloat = self.collectionView!.frame.size.width - sectionInset.left-sectionInset.right
136 | let spaceColumCount:CGFloat = CGFloat(self.columnCount-1)
137 | return floor((width - (spaceColumCount*self.minimumColumnSpacing)) / CGFloat(self.columnCount))
138 | }
139 |
140 | override func prepare(){
141 | super.prepare()
142 |
143 | let numberOfSections = self.collectionView!.numberOfSections
144 | if numberOfSections == 0 {
145 | return
146 | }
147 |
148 | self.headersAttributes.removeAllObjects()
149 | self.footersAttributes.removeAllObjects()
150 | self.unionRects.removeAllObjects()
151 | self.columnHeights.removeAllObjects()
152 | self.allItemAttributes.removeAllObjects()
153 | self.sectionItemAttributes.removeAllObjects()
154 |
155 | var idx = 0
156 | while idx 0 {
190 | attributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: CHTCollectionElementKindSectionHeader, with: IndexPath(row: 0, section: section))
191 | attributes.frame = CGRect(x: 0, y: top, width: self.collectionView!.frame.size.width, height: heightHeader)
192 | self.headersAttributes.setObject(attributes, forKey: (section as NSCopying))
193 | self.allItemAttributes.add(attributes)
194 |
195 | top = attributes.frame.maxX
196 | }
197 | top += sectionInset.top
198 | for idx in 0 ..< self.columnCount {
199 | self.columnHeights[idx]=top;
200 | }
201 |
202 | /*
203 | * 3. Section items
204 | */
205 | let itemCount = self.collectionView!.numberOfItems(inSection: section)
206 | let itemAttributes = NSMutableArray(capacity: itemCount)
207 |
208 | // Item will be put into shortest column.
209 | for idx in 0 ..< itemCount {
210 | let indexPath = IndexPath(item: idx, section: section)
211 |
212 | let columnIndex = self.nextColumnIndexForItem(idx)
213 | let xOffset = sectionInset.left + (itemWidth + self.minimumColumnSpacing) * CGFloat(columnIndex)
214 | let yOffset = (self.columnHeights.object(at: columnIndex) as AnyObject).doubleValue
215 | let itemSize = self.delegate?.collectionView(self.collectionView!, layout: self, sizeForItemAtIndexPath: indexPath)
216 | var itemHeight : CGFloat = 0.0
217 | if itemSize?.height > 0 && itemSize?.width > 0 {
218 | itemHeight = floor(itemSize!.height*itemWidth/itemSize!.width)
219 | }
220 |
221 | attributes = UICollectionViewLayoutAttributes(forCellWith: indexPath)
222 | attributes.frame = CGRect(x: xOffset, y: CGFloat(yOffset!), width: itemWidth, height: itemHeight)
223 | itemAttributes.add(attributes)
224 | self.allItemAttributes.add(attributes)
225 | self.columnHeights[columnIndex]=attributes.frame.maxY + minimumInteritemSpacing;
226 | }
227 | self.sectionItemAttributes.add(itemAttributes)
228 |
229 | /*
230 | * 4. Section footer
231 | */
232 | var footerHeight : CGFloat = 0.0
233 | let columnIndex = self.longestColumnIndex()
234 | top = CGFloat((self.columnHeights.object(at: columnIndex) as AnyObject).floatValue) - minimumInteritemSpacing + sectionInset.bottom
235 |
236 | if let height = self.delegate?.colletionView?(self.collectionView!, layout: self, heightForFooterInSection: section){
237 | footerHeight = height
238 | }else{
239 | footerHeight = self.footerHeight
240 | }
241 |
242 | if footerHeight > 0 {
243 | attributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: CHTCollectionElementKindSectionFooter, with: IndexPath(item: 0, section: section))
244 | attributes.frame = CGRect(x: 0, y: top, width: self.collectionView!.frame.size.width, height: footerHeight)
245 | self.footersAttributes.setObject(attributes, forKey: section as NSCopying)
246 | self.allItemAttributes.add(attributes)
247 | top = attributes.frame.maxY
248 | }
249 |
250 | for idx in 0 ..< self.columnCount {
251 | self.columnHeights[idx] = top
252 | }
253 | }
254 |
255 | idx = 0;
256 | let itemCounts = self.allItemAttributes.count
257 | while(idx < itemCounts){
258 | let rect1 = (self.allItemAttributes.object(at: idx) as AnyObject).frame as CGRect
259 | idx = min(idx + unionSize, itemCounts) - 1
260 | let rect2 = (self.allItemAttributes.object(at: idx) as AnyObject).frame as CGRect
261 | self.unionRects.add(NSValue(cgRect:rect1.union(rect2)))
262 | idx += 1
263 | }
264 | }
265 |
266 | override var collectionViewContentSize : CGSize{
267 | let numberOfSections = self.collectionView!.numberOfSections
268 | if numberOfSections == 0{
269 | return CGSize.zero
270 | }
271 |
272 | var contentSize = self.collectionView!.bounds.size as CGSize
273 | let height = self.columnHeights.object(at: 0) as! NSNumber
274 | contentSize.height = CGFloat(height.doubleValue)
275 | return contentSize
276 | }
277 |
278 | override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes?{
279 | if indexPath.section >= self.sectionItemAttributes.count {
280 | return nil
281 | }
282 | if indexPath.item >= (self.sectionItemAttributes.object(at: indexPath.section) as AnyObject).count{
283 | return nil;
284 | }
285 | let list = self.sectionItemAttributes.object(at: indexPath.section) as! NSArray
286 | return list.object(at: indexPath.item) as? UICollectionViewLayoutAttributes
287 | }
288 |
289 | override func layoutAttributesForSupplementaryView(ofKind elementKind: String, at indexPath: IndexPath) -> UICollectionViewLayoutAttributes{
290 | var attribute = UICollectionViewLayoutAttributes()
291 | if elementKind == CHTCollectionElementKindSectionHeader{
292 | attribute = self.headersAttributes.object(forKey: indexPath.section) as! UICollectionViewLayoutAttributes
293 | }else if elementKind == CHTCollectionElementKindSectionFooter{
294 | attribute = self.footersAttributes.object(forKey: indexPath.section) as! UICollectionViewLayoutAttributes
295 | }
296 | return attribute
297 | }
298 |
299 | override func layoutAttributesForElements (in rect : CGRect) -> [UICollectionViewLayoutAttributes] {
300 | var begin = 0, end = self.unionRects.count
301 | let attrs = NSMutableArray()
302 |
303 | for i in 0 ..< end {
304 | if rect.intersects((self.unionRects.object(at: i) as AnyObject).cgRectValue){
305 | begin = i * unionSize;
306 | break
307 | }
308 | }
309 | var i = self.unionRects.count - 1
310 | while i>=0 {
311 | if rect.intersects((self.unionRects.object(at: i) as AnyObject).cgRectValue){
312 | end = min((i+1)*unionSize,self.allItemAttributes.count)
313 | break
314 | }
315 | i -= 1
316 | }
317 | for i in begin ..< end {
318 | let attr = self.allItemAttributes.object(at: i) as! UICollectionViewLayoutAttributes
319 | if rect.intersects(attr.frame) {
320 | attrs.add(attr)
321 | }
322 | }
323 |
324 | return NSArray(array: attrs) as! [UICollectionViewLayoutAttributes]
325 | }
326 |
327 | override func shouldInvalidateLayout (forBoundsChange newBounds : CGRect) -> Bool {
328 | let oldBounds = self.collectionView!.bounds
329 | if newBounds.width != oldBounds.width{
330 | return true
331 | }
332 | return false
333 | }
334 |
335 |
336 | /**
337 | * Find the shortest column.
338 | *
339 | * @return index for the shortest column
340 | */
341 | func shortestColumnIndex () -> NSInteger {
342 | var index = 0
343 | var shorestHeight = MAXFLOAT
344 |
345 |
346 | self.columnHeights.enumerateObjects({(object : Any, idx : Int,pointer :UnsafeMutablePointer) in
347 | let height = (object as AnyObject).floatValue
348 | if (height NSInteger {
363 | var index = 0
364 | var longestHeight: CGFloat = 0.0
365 |
366 | self.columnHeights.enumerateObjects({(object : Any, idx : Int,pointer :UnsafeMutablePointer) in
367 | let height = CGFloat((object as AnyObject).floatValue!)
368 | if (height > longestHeight){
369 | longestHeight = height
370 | index = idx
371 | }
372 | })
373 | return index
374 | }
375 |
376 | /**
377 | * Find the index for the next column.d *
378 | * @return index for the next column
379 | */
380 | func nextColumnIndexForItem (_ item : NSInteger) -> Int {
381 | var index = 0
382 | switch (self.itemRenderDirection){
383 | case .shortestFirst :
384 | index = self.shortestColumnIndex()
385 | case .leftToRight :
386 | index = (item%self.columnCount)
387 | case .rightToLeft:
388 | index = (self.columnCount - 1) - (item % self.columnCount);
389 | // default:
390 | // index = self.shortestColumnIndex()
391 | }
392 | return index
393 | }
394 | }
395 |
--------------------------------------------------------------------------------
/PinterestSwift/Extension.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+Utils.swift
3 | // PinterestSwift
4 | //
5 | // Created by Nicholas Tau on 7/2/14.
6 | // Copyright (c) 2014 Nicholas Tau. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 |
12 | extension UIView{
13 | func origin (_ point : CGPoint){
14 | frame.origin.x = point.x
15 | frame.origin.y = point.y
16 | }
17 | }
18 |
19 | var kIndexPathPointer = "kIndexPathPointer"
20 |
21 | extension UICollectionView{
22 | // var currentIndexPath : NSIndexPath{
23 | // get{
24 | // return objc_getAssociatedObject(self,kIndexPathPointer) as NSIndexPath
25 | // }set{
26 | // objc_setAssociatedObject(self, kIndexPathPointer, newValue, objc_AssociationPolicy(OBJC_ASSOCIATION_RETAIN_NONATOMIC))
27 | // }} WTF! error when building, it's a bug
28 | // http://stackoverflow.com/questions/24021291/import-extension-file-in-swift
29 |
30 | func setToIndexPath (_ indexPath : IndexPath){
31 | objc_setAssociatedObject(self, &kIndexPathPointer, indexPath, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
32 | }
33 |
34 | func toIndexPath () -> IndexPath {
35 | let index = self.contentOffset.x/self.frame.size.width
36 | if index > 0{
37 | return IndexPath(row: Int(index), section: 0)
38 | }else if let indexPath = objc_getAssociatedObject(self,&kIndexPathPointer) as? IndexPath {
39 | return indexPath
40 | }else{
41 | return IndexPath(row: 0, section: 0)
42 | }
43 | }
44 |
45 | func fromPageIndexPath () -> IndexPath{
46 | let index : Int = Int(self.contentOffset.x/self.frame.size.width)
47 | return IndexPath(row: index, section: 0)
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/PinterestSwift/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "40x40",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "60x60",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "60x60",
21 | "scale" : "3x"
22 | }
23 | ],
24 | "info" : {
25 | "version" : 1,
26 | "author" : "xcode"
27 | }
28 | }
--------------------------------------------------------------------------------
/PinterestSwift/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "extent" : "full-screen",
5 | "idiom" : "iphone",
6 | "subtype" : "736h",
7 | "filename" : "retina55.png",
8 | "minimum-system-version" : "8.0",
9 | "orientation" : "portrait",
10 | "scale" : "3x"
11 | },
12 | {
13 | "orientation" : "landscape",
14 | "idiom" : "iphone",
15 | "extent" : "full-screen",
16 | "minimum-system-version" : "8.0",
17 | "subtype" : "736h",
18 | "scale" : "3x"
19 | },
20 | {
21 | "extent" : "full-screen",
22 | "idiom" : "iphone",
23 | "subtype" : "667h",
24 | "filename" : "retina47.png",
25 | "minimum-system-version" : "8.0",
26 | "orientation" : "portrait",
27 | "scale" : "2x"
28 | },
29 | {
30 | "orientation" : "portrait",
31 | "idiom" : "iphone",
32 | "extent" : "full-screen",
33 | "minimum-system-version" : "7.0",
34 | "scale" : "2x"
35 | },
36 | {
37 | "extent" : "full-screen",
38 | "idiom" : "iphone",
39 | "subtype" : "retina4",
40 | "filename" : "retina4.png",
41 | "minimum-system-version" : "7.0",
42 | "orientation" : "portrait",
43 | "scale" : "2x"
44 | },
45 | {
46 | "orientation" : "portrait",
47 | "idiom" : "ipad",
48 | "extent" : "full-screen",
49 | "minimum-system-version" : "7.0",
50 | "scale" : "1x"
51 | },
52 | {
53 | "orientation" : "landscape",
54 | "idiom" : "ipad",
55 | "extent" : "full-screen",
56 | "minimum-system-version" : "7.0",
57 | "scale" : "1x"
58 | },
59 | {
60 | "orientation" : "portrait",
61 | "idiom" : "ipad",
62 | "extent" : "full-screen",
63 | "minimum-system-version" : "7.0",
64 | "scale" : "2x"
65 | },
66 | {
67 | "orientation" : "landscape",
68 | "idiom" : "ipad",
69 | "extent" : "full-screen",
70 | "minimum-system-version" : "7.0",
71 | "scale" : "2x"
72 | },
73 | {
74 | "orientation" : "portrait",
75 | "idiom" : "iphone",
76 | "extent" : "full-screen",
77 | "scale" : "1x"
78 | },
79 | {
80 | "orientation" : "portrait",
81 | "idiom" : "iphone",
82 | "extent" : "full-screen",
83 | "scale" : "2x"
84 | },
85 | {
86 | "orientation" : "portrait",
87 | "idiom" : "iphone",
88 | "extent" : "full-screen",
89 | "subtype" : "retina4",
90 | "scale" : "2x"
91 | },
92 | {
93 | "orientation" : "portrait",
94 | "idiom" : "ipad",
95 | "extent" : "to-status-bar",
96 | "scale" : "1x"
97 | },
98 | {
99 | "orientation" : "portrait",
100 | "idiom" : "ipad",
101 | "extent" : "full-screen",
102 | "scale" : "1x"
103 | },
104 | {
105 | "orientation" : "landscape",
106 | "idiom" : "ipad",
107 | "extent" : "to-status-bar",
108 | "scale" : "1x"
109 | },
110 | {
111 | "orientation" : "landscape",
112 | "idiom" : "ipad",
113 | "extent" : "full-screen",
114 | "scale" : "1x"
115 | },
116 | {
117 | "orientation" : "portrait",
118 | "idiom" : "ipad",
119 | "extent" : "to-status-bar",
120 | "scale" : "2x"
121 | },
122 | {
123 | "orientation" : "portrait",
124 | "idiom" : "ipad",
125 | "extent" : "full-screen",
126 | "scale" : "2x"
127 | },
128 | {
129 | "orientation" : "landscape",
130 | "idiom" : "ipad",
131 | "extent" : "to-status-bar",
132 | "scale" : "2x"
133 | },
134 | {
135 | "orientation" : "landscape",
136 | "idiom" : "ipad",
137 | "extent" : "full-screen",
138 | "scale" : "2x"
139 | }
140 | ],
141 | "info" : {
142 | "version" : 1,
143 | "author" : "xcode"
144 | }
145 | }
--------------------------------------------------------------------------------
/PinterestSwift/Images.xcassets/LaunchImage.launchimage/retina4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/Images.xcassets/LaunchImage.launchimage/retina4.png
--------------------------------------------------------------------------------
/PinterestSwift/Images.xcassets/LaunchImage.launchimage/retina47.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/Images.xcassets/LaunchImage.launchimage/retina47.png
--------------------------------------------------------------------------------
/PinterestSwift/Images.xcassets/LaunchImage.launchimage/retina55.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/Images.xcassets/LaunchImage.launchimage/retina55.png
--------------------------------------------------------------------------------
/PinterestSwift/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.demon.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/PinterestSwift/Macro.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Macro.swift
3 | // PinterestSwift
4 | //
5 | // Created by Nicholas Tau on 7/1/14.
6 | // Copyright (c) 2014 Nicholas Tau. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 |
12 | let screenBounds = UIScreen.main.bounds
13 | let screenSize = screenBounds.size
14 | let screenWidth = screenSize.width
15 | let screenHeight = screenSize.height
16 | let gridWidth : CGFloat = (screenSize.width/2)-5.0
17 | let navigationHeight : CGFloat = 44.0
18 | let statubarHeight : CGFloat = 20.0
19 | let navigationHeaderAndStatusbarHeight : CGFloat = navigationHeight + statubarHeight
20 |
--------------------------------------------------------------------------------
/PinterestSwift/NTHorizontalPageViewCell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NTHorizontalPageViewCell.swift
3 | // PinterestSwift
4 | //
5 | // Created by Nicholas Tau on 7/1/14.
6 | // Copyright (c) 2014 Nicholas Tau. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 |
12 | let cellIdentify = "cellIdentify"
13 |
14 | class NTTableViewCell : UITableViewCell{
15 |
16 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String!) {
17 | super.init(style: style, reuseIdentifier: reuseIdentifier)
18 | self.textLabel?.font = UIFont.systemFont(ofSize: 13)
19 | }
20 |
21 | required init?(coder aDecoder: NSCoder) {
22 | fatalError("init(coder:) has not been implemented")
23 | }
24 |
25 | override func layoutSubviews() {
26 | super.layoutSubviews()
27 | let imageView :UIImageView = self.imageView!;
28 | imageView.frame = CGRect.zero
29 | if (imageView.image != nil) {
30 | let imageHeight = imageView.image!.size.height*screenWidth/imageView.image!.size.width
31 | imageView.frame = CGRect(x: 0, y: 0, width: screenWidth, height: imageHeight)
32 | }
33 | }
34 | }
35 |
36 | class NTHorizontalPageViewCell : UICollectionViewCell, UITableViewDelegate, UITableViewDataSource{
37 | var imageName : String?
38 | var pullAction : ((_ offset : CGPoint) -> Void)?
39 | var tappedAction : (() -> Void)?
40 | let tableView = UITableView(frame: screenBounds, style: UITableView.Style.plain)
41 | override init(frame: CGRect) {
42 | super.init(frame: frame)
43 | backgroundColor = UIColor.lightGray
44 |
45 | contentView.addSubview(tableView)
46 | tableView.register(NTTableViewCell.self, forCellReuseIdentifier: cellIdentify)
47 | tableView.delegate = self
48 | tableView.dataSource = self
49 | }
50 |
51 | required init?(coder aDecoder: NSCoder) {
52 | fatalError("init(coder:) has not been implemented")
53 | }
54 |
55 | override func layoutSubviews() {
56 | super.layoutSubviews()
57 | tableView.reloadData()
58 | }
59 |
60 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
61 | return 10
62 | }
63 |
64 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
65 | {
66 | let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentify) as! NTTableViewCell?
67 | cell?.imageView?.image = nil
68 | cell?.textLabel?.text = nil
69 | if indexPath.row == 0 {
70 | let image = UIImage(named: imageName!)
71 | cell?.imageView?.image = image
72 | }else{
73 | cell?.textLabel?.text = "try pull to pop view controller 😃"
74 | }
75 | cell?.setNeedsLayout()
76 | return cell!
77 | }
78 |
79 |
80 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat{
81 | var cellHeight : CGFloat = navigationHeight
82 | if indexPath.row == 0{
83 | let image:UIImage! = UIImage(named: imageName!)
84 | let imageHeight = image.size.height*screenWidth/image.size.width
85 | cellHeight = imageHeight
86 | }
87 | return cellHeight
88 | }
89 |
90 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
91 | tappedAction?()
92 | }
93 |
94 | func scrollViewWillBeginDecelerating(_ scrollView : UIScrollView){
95 | if scrollView.contentOffset.y < navigationHeight{
96 | pullAction?(scrollView.contentOffset)
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/PinterestSwift/NTHorizontalPageViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NTHorizontalPageViewController.swift
3 | // PinterestSwift
4 | //
5 | // Created by Nicholas Tau on 7/1/14.
6 | // Copyright (c) 2014 Nicholas Tau. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 |
12 | let horizontalPageViewCellIdentify = "horizontalPageViewCellIdentify"
13 |
14 | class NTHorizontalPageViewController : UICollectionViewController, NTTransitionProtocol ,NTHorizontalPageViewControllerProtocol{
15 |
16 | var imageNameList : Array = []
17 | var pullOffset = CGPoint.zero
18 |
19 | init(collectionViewLayout layout: UICollectionViewLayout!, currentIndexPath indexPath: IndexPath){
20 | super.init(collectionViewLayout:layout)
21 | let collectionView :UICollectionView = self.collectionView!;
22 | collectionView.isPagingEnabled = true
23 | collectionView.register(NTHorizontalPageViewCell.self, forCellWithReuseIdentifier: horizontalPageViewCellIdentify)
24 | collectionView.setToIndexPath(indexPath)
25 | collectionView.performBatchUpdates({collectionView.reloadData()}, completion: { finished in
26 | if finished {
27 | collectionView.scrollToItem(at: indexPath,at:.centeredHorizontally, animated: false)
28 | }});
29 | }
30 |
31 | required init?(coder aDecoder: NSCoder) {
32 | fatalError("init(coder:) has not been implemented")
33 | }
34 |
35 | override func viewDidLoad(){
36 | super.viewDidLoad()
37 | }
38 |
39 | override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell{
40 | let collectionCell: NTHorizontalPageViewCell = collectionView.dequeueReusableCell(withReuseIdentifier: horizontalPageViewCellIdentify, for: indexPath) as! NTHorizontalPageViewCell
41 | collectionCell.imageName = self.imageNameList[indexPath.row] as String
42 | collectionCell.tappedAction = {}
43 | collectionCell.pullAction = { offset in
44 | self.pullOffset = offset
45 | self.navigationController!.popViewController(animated: true)
46 | }
47 | collectionCell.setNeedsLayout()
48 | return collectionCell
49 | }
50 |
51 | override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int{
52 | return imageNameList.count;
53 | }
54 |
55 | func transitionCollectionView() -> UICollectionView!{
56 | return collectionView
57 | }
58 |
59 | func pageViewCellScrollViewContentOffset() -> CGPoint{
60 | return self.pullOffset
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/PinterestSwift/NTNavigationController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NTNavigationController.swift
3 | // PinterestSwift
4 | //
5 | // Created by Nicholas Tau on 7/2/14.
6 | // Copyright (c) 2014 Nicholas Tau. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 | class NTNavigationController : UINavigationController{
12 | override func popViewController(animated: Bool) -> UIViewController
13 | {
14 | //viewWillAppearWithPageIndex
15 | let childrenCount = self.viewControllers.count
16 | let toViewController = self.viewControllers[childrenCount-2] as! NTWaterFallViewControllerProtocol
17 | let toView = toViewController.transitionCollectionView()
18 | let popedViewController = self.viewControllers[childrenCount-1] as! UICollectionViewController
19 | let popView = popedViewController.collectionView!;
20 | let indexPath = popView.fromPageIndexPath()
21 | toViewController.viewWillAppearWithPageIndex(indexPath.row)
22 | toView?.setToIndexPath(indexPath)
23 | return super.popViewController(animated: animated)!
24 | }
25 |
26 | // override func pushViewController(viewController: UIViewController!, animated: Bool) {
27 | // let childrenCount = self.viewControllers.count
28 | // let toView = viewController.view
29 | // let currentView = self.viewControllers[childrenCount-1].view
30 | //// if toView is UICollectionView && currentView is UICollectionView{
31 | //// let currentIndexPath = (currentView as UICollectionView).currentIndexPath()
32 | //// (toView as UICollectionView).setCurrentIndexPath(currentIndexPath)
33 | //// }
34 | // super.pushViewController(viewController, animated: animated)
35 | // }
36 | }
37 |
--------------------------------------------------------------------------------
/PinterestSwift/NTTransition.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NTTransition.swift
3 | // PinterestSwift
4 | //
5 | // Created by Nicholas Tau on 7/2/14.
6 | // Copyright (c) 2014 Nicholas Tau. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 |
12 | let animationDuration = 0.35
13 | let animationScale = screenWidth/gridWidth // screenWidth / the width of waterfall collection view's grid
14 |
15 | class NTTransition : NSObject , UIViewControllerAnimatedTransitioning{
16 | var presenting = false
17 |
18 | func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval{
19 | return animationDuration
20 | }
21 |
22 | func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
23 | let fromViewController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from) as UIViewController?
24 | let toViewController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to) as UIViewController?
25 | let containerView = transitionContext.containerView
26 |
27 | if presenting {
28 | let toView = toViewController!.view!
29 | containerView.addSubview(toView)
30 | toView.isHidden = true
31 |
32 | let waterFallView = (toViewController! as! NTTransitionProtocol).transitionCollectionView()!
33 | let pageView = (fromViewController as! NTTransitionProtocol).transitionCollectionView()!
34 | waterFallView.layoutIfNeeded()
35 | let indexPath = pageView.fromPageIndexPath()
36 | let gridView = waterFallView.cellForItem(at: indexPath)
37 | let leftUpperPoint = gridView!.convert(CGPoint.zero, to: toViewController!.view)
38 |
39 | let snapShot = (gridView as! NTTansitionWaterfallGridViewProtocol).snapShotForTransition()
40 | snapShot?.transform = CGAffineTransform(scaleX: animationScale, y: animationScale)
41 | let pullOffsetY = (fromViewController as! NTHorizontalPageViewControllerProtocol).pageViewCellScrollViewContentOffset().y
42 | let offsetY : CGFloat = fromViewController!.navigationController!.isNavigationBarHidden ? 0.0 : navigationHeaderAndStatusbarHeight
43 | snapShot?.origin(CGPoint(x: 0, y: -pullOffsetY+offsetY))
44 | containerView.addSubview(snapShot!)
45 |
46 | toView.isHidden = false
47 | toView.alpha = 0
48 | toView.transform = (snapShot?.transform)!
49 | toView.frame = CGRect(x: -(leftUpperPoint.x * animationScale),y: -((leftUpperPoint.y-offsetY) * animationScale+pullOffsetY+offsetY),
50 | width: toView.frame.size.width, height: toView.frame.size.height)
51 | let whiteViewContainer = UIView(frame: screenBounds)
52 | whiteViewContainer.backgroundColor = UIColor.white
53 | containerView.addSubview(snapShot!)
54 | containerView.insertSubview(whiteViewContainer, belowSubview: toView)
55 |
56 | UIView.animate(withDuration: animationDuration, animations: {
57 | snapShot?.transform = CGAffineTransform.identity
58 | snapShot?.frame = CGRect(x: leftUpperPoint.x, y: leftUpperPoint.y, width: (snapShot?.frame.size.width)!, height: (snapShot?.frame.size.height)!)
59 | toView.transform = CGAffineTransform.identity
60 | toView.frame = CGRect(x: 0, y: 0, width: toView.frame.size.width, height: toView.frame.size.height);
61 | toView.alpha = 1
62 | }, completion:{finished in
63 | if finished {
64 | snapShot?.removeFromSuperview()
65 | whiteViewContainer.removeFromSuperview()
66 | transitionContext.completeTransition(true)
67 | }
68 | })
69 | }else{
70 | let fromView = fromViewController!.view!
71 | let toView = toViewController!.view
72 |
73 | let waterFallView : UICollectionView = (fromViewController as! NTTransitionProtocol).transitionCollectionView()
74 | let pageView : UICollectionView = (toViewController! as! NTTransitionProtocol).transitionCollectionView()
75 |
76 | containerView.addSubview(fromView)
77 | containerView.addSubview(toView!)
78 |
79 | let indexPath = waterFallView.toIndexPath()
80 | let gridView = waterFallView.cellForItem(at: indexPath as IndexPath)
81 |
82 | let leftUpperPoint = gridView!.convert(CGPoint.zero, to: nil)
83 | pageView.isHidden = true
84 | pageView.scrollToItem(at: indexPath as IndexPath, at:.centeredHorizontally, animated: false)
85 |
86 | let offsetY : CGFloat = fromViewController!.navigationController!.isNavigationBarHidden ? 0.0 : navigationHeaderAndStatusbarHeight
87 | let offsetStatuBar : CGFloat = fromViewController!.navigationController!.isNavigationBarHidden ? 0.0 :
88 | statubarHeight;
89 | let snapShot = (gridView as! NTTansitionWaterfallGridViewProtocol).snapShotForTransition()
90 | containerView.addSubview(snapShot!)
91 | snapShot?.origin(leftUpperPoint)
92 | UIView.animate(withDuration: animationDuration, animations: {
93 | snapShot?.transform = CGAffineTransform(scaleX: animationScale,
94 | y: animationScale)
95 | snapShot?.frame = CGRect(x: 0, y: offsetY, width: (snapShot?.frame.size.width)!, height: (snapShot?.frame.size.height)!)
96 |
97 | fromView.alpha = 0
98 | fromView.transform = (snapShot?.transform)!
99 | fromView.frame = CGRect(x: -(leftUpperPoint.x)*animationScale,
100 | y: -(leftUpperPoint.y-offsetStatuBar)*animationScale+offsetStatuBar,
101 | width: fromView.frame.size.width,
102 | height: fromView.frame.size.height)
103 | },completion:{finished in
104 | if finished {
105 | snapShot?.removeFromSuperview()
106 | pageView.isHidden = false
107 | fromView.transform = CGAffineTransform.identity
108 | transitionContext.completeTransition(true)
109 | }
110 | })
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/PinterestSwift/NTTransitionProtocol.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NTTransitionProtocol.swift
3 | // PinterestSwift
4 | //
5 | // Created by Nicholas Tau on 7/2/14.
6 | // Copyright (c) 2014 Nicholas Tau. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 |
12 | @objc protocol NTTransitionProtocol{
13 | func transitionCollectionView() -> UICollectionView!
14 | }
15 |
16 | @objc protocol NTTansitionWaterfallGridViewProtocol{
17 | func snapShotForTransition() -> UIView!
18 | }
19 |
20 | @objc protocol NTWaterFallViewControllerProtocol : NTTransitionProtocol{
21 | func viewWillAppearWithPageIndex(_ pageIndex : NSInteger)
22 | }
23 |
24 | @objc protocol NTHorizontalPageViewControllerProtocol : NTTransitionProtocol{
25 | func pageViewCellScrollViewContentOffset() -> CGPoint
26 | }
27 |
--------------------------------------------------------------------------------
/PinterestSwift/NTWaterfallViewCell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NTWaterfallViewCell.swift
3 | // PinterestSwift
4 | //
5 | // Created by Nicholas Tau on 6/30/14.
6 | // Copyright (c) 2014 Nicholas Tau. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class NTWaterfallViewCell :UICollectionViewCell, NTTansitionWaterfallGridViewProtocol{
12 | var imageName : String?
13 | var imageViewContent : UIImageView = UIImageView()
14 | required init?(coder aDecoder: NSCoder) {
15 | fatalError("init(coder:) has not been implemented")
16 | }
17 | override init(frame: CGRect) {
18 | super.init(frame: frame)
19 | backgroundColor = UIColor.lightGray
20 | contentView.addSubview(imageViewContent)
21 | }
22 | override func layoutSubviews() {
23 | super.layoutSubviews()
24 | imageViewContent.frame = CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height)
25 | imageViewContent.image = UIImage(named: imageName!)
26 | }
27 |
28 | func snapShotForTransition() -> UIView! {
29 | let snapShotView = UIImageView(image: self.imageViewContent.image)
30 | snapShotView.frame = imageViewContent.frame
31 | return snapShotView
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/PinterestSwift/NTWaterfallViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // PinterestSwift
4 | //
5 | // Created by Nicholas Tau on 6/30/14.
6 | // Copyright (c) 2014 Nicholas Tau. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | let waterfallViewCellIdentify = "waterfallViewCellIdentify"
12 |
13 | class NavigationControllerDelegate: NSObject, UINavigationControllerDelegate{
14 | func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationController.Operation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning?{
15 |
16 | let fromVCConfromA = (fromVC as? NTTransitionProtocol)
17 | let fromVCConfromB = (fromVC as? NTWaterFallViewControllerProtocol)
18 | let fromVCConfromC = (fromVC as? NTHorizontalPageViewControllerProtocol)
19 |
20 | let toVCConfromA = (toVC as? NTTransitionProtocol)
21 | let toVCConfromB = (toVC as? NTWaterFallViewControllerProtocol)
22 | let toVCConfromC = (toVC as? NTHorizontalPageViewControllerProtocol)
23 | if((fromVCConfromA != nil)&&(toVCConfromA != nil)&&(
24 | (fromVCConfromB != nil && toVCConfromC != nil)||(fromVCConfromC != nil && toVCConfromB != nil))){
25 | let transition = NTTransition()
26 | transition.presenting = operation == .pop
27 | return transition
28 | }else{
29 | return nil
30 | }
31 |
32 | }
33 | }
34 |
35 | class NTWaterfallViewController:UICollectionViewController,CHTCollectionViewDelegateWaterfallLayout, NTTransitionProtocol, NTWaterFallViewControllerProtocol{
36 | // class var sharedInstance: NSInteger = 0 Are u kidding me?
37 | var imageNameList : Array = []
38 | let delegateHolder = NavigationControllerDelegate()
39 | override func viewDidLoad() {
40 | super.viewDidLoad()
41 | // Do any additional setup after loading the view, typically from a nib.
42 | self.navigationController!.delegate = delegateHolder
43 | self.view.backgroundColor = UIColor.yellow
44 |
45 | var index = 0
46 | while index < 14{
47 | let imageName = NSString(format: "%d.jpg", index)
48 | imageNameList.append(imageName)
49 | index += 1
50 | }
51 |
52 | let collection :UICollectionView = collectionView!;
53 | collection.frame = screenBounds
54 | collection.setCollectionViewLayout(CHTCollectionViewWaterfallLayout(), animated: false)
55 | collection.backgroundColor = UIColor.gray
56 | collection.register(NTWaterfallViewCell.self, forCellWithReuseIdentifier: waterfallViewCellIdentify)
57 | collection.reloadData()
58 |
59 | }
60 |
61 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize{
62 | let image:UIImage! = UIImage(named: self.imageNameList[indexPath.row] as String)
63 | let imageHeight = image.size.height * gridWidth/image.size.width
64 | return CGSize(width: gridWidth, height: imageHeight)
65 | }
66 |
67 | override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell{
68 | let collectionCell: NTWaterfallViewCell = collectionView.dequeueReusableCell(withReuseIdentifier: waterfallViewCellIdentify, for: indexPath) as! NTWaterfallViewCell
69 | collectionCell.imageName = self.imageNameList[indexPath.row] as String
70 | collectionCell.setNeedsLayout()
71 | return collectionCell;
72 | }
73 |
74 | override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int{
75 | return imageNameList.count;
76 | }
77 |
78 | override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath){
79 | let pageViewController =
80 | NTHorizontalPageViewController(collectionViewLayout: pageViewControllerLayout(), currentIndexPath:indexPath)
81 | pageViewController.imageNameList = imageNameList
82 | collectionView.setToIndexPath(indexPath)
83 | navigationController!.pushViewController(pageViewController, animated: true)
84 | }
85 |
86 | func pageViewControllerLayout () -> UICollectionViewFlowLayout {
87 | let flowLayout = UICollectionViewFlowLayout()
88 | let itemSize = self.navigationController!.isNavigationBarHidden ?
89 | CGSize(width: screenWidth, height: screenHeight+20) : CGSize(width: screenWidth, height: screenHeight-navigationHeaderAndStatusbarHeight)
90 | flowLayout.itemSize = itemSize
91 | flowLayout.minimumLineSpacing = 0
92 | flowLayout.minimumInteritemSpacing = 0
93 | flowLayout.scrollDirection = .horizontal
94 | return flowLayout
95 | }
96 |
97 | func viewWillAppearWithPageIndex(_ pageIndex: NSInteger) {
98 | var position: UICollectionView.ScrollPosition =
99 | UICollectionView.ScrollPosition.centeredHorizontally.intersection(.centeredVertically)
100 | let image: UIImage! = UIImage(named: self.imageNameList[pageIndex] as String)
101 | let imageHeight = image.size.height*gridWidth/image.size.width
102 | if imageHeight > 400 {//whatever you like, it's the max value for height of image
103 | position = .top
104 | }
105 | let currentIndexPath = IndexPath(row: pageIndex, section: 0)
106 | let collectionView = self.collectionView!;
107 | collectionView.setToIndexPath(currentIndexPath)
108 | if pageIndex < 2 {
109 | collectionView.setContentOffset(CGPoint.zero, animated: false)
110 | } else {
111 | collectionView.scrollToItem(at: currentIndexPath, at: position, animated: false)
112 | }
113 | }
114 |
115 | func transitionCollectionView() -> UICollectionView!{
116 | return collectionView
117 | }
118 |
119 | override func didReceiveMemoryWarning() {
120 | super.didReceiveMemoryWarning()
121 | // Dispose of any resources that can be recreated.
122 | }
123 |
124 |
125 | }
126 |
127 |
--------------------------------------------------------------------------------
/PinterestSwift/PinterestSwift-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 | #import "CHTCollectionViewWaterfallLayout.h"
5 |
--------------------------------------------------------------------------------
/PinterestSwift/images/0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/0.jpg
--------------------------------------------------------------------------------
/PinterestSwift/images/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/1.jpg
--------------------------------------------------------------------------------
/PinterestSwift/images/10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/10.jpg
--------------------------------------------------------------------------------
/PinterestSwift/images/11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/11.jpg
--------------------------------------------------------------------------------
/PinterestSwift/images/12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/12.jpg
--------------------------------------------------------------------------------
/PinterestSwift/images/13.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/13.jpg
--------------------------------------------------------------------------------
/PinterestSwift/images/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/2.jpg
--------------------------------------------------------------------------------
/PinterestSwift/images/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/3.jpg
--------------------------------------------------------------------------------
/PinterestSwift/images/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/4.jpg
--------------------------------------------------------------------------------
/PinterestSwift/images/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/5.jpg
--------------------------------------------------------------------------------
/PinterestSwift/images/6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/6.jpg
--------------------------------------------------------------------------------
/PinterestSwift/images/7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/7.jpg
--------------------------------------------------------------------------------
/PinterestSwift/images/8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/8.jpg
--------------------------------------------------------------------------------
/PinterestSwift/images/9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/demonnico/PinterestSwift/0b4816b7ca26299fb60cc71d89d5b9c71e2e4880/PinterestSwift/images/9.jpg
--------------------------------------------------------------------------------
/PinterestSwiftTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.demon.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PinterestSwiftTests/PinterestSwiftTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // PinterestSwiftTests.swift
3 | // PinterestSwiftTests
4 | //
5 | // Created by Nicholas Tau on 6/30/14.
6 | // Copyright (c) 2014 Nicholas Tau. All rights reserved.
7 | //
8 |
9 | import XCTest
10 |
11 | class PinterestSwiftTests: XCTestCase {
12 |
13 | override func setUp() {
14 | super.setUp()
15 | // Put setup code here. This method is called before the invocation of each test method in the class.
16 | }
17 |
18 | override func tearDown() {
19 | // Put teardown code here. This method is called after the invocation of each test method in the class.
20 | super.tearDown()
21 | }
22 |
23 | func testExample() {
24 | // This is an example of a functional test case.
25 | XCTAssert(true, "Pass")
26 | }
27 |
28 | func testPerformanceExample() {
29 | // This is an example of a performance test case.
30 | self.measure() {
31 | // Put the code you want to measure the time of here.
32 | }
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | PinterestSwift
2 | ==============
3 |
4 | Compatible with Xcode 11 / Swift 5.0
5 |
6 | This is a Swift based demo project to show how to make the transition Pinterest 2.0+ liked.
7 |
8 | Refer from [StackOverFlow](http://stackoverflow.com/questions/22900499/how-to-transition-from-uicollectionview-to-uiviewcontroller-like-pinterest-evern/24399337#24399337)
9 |
10 | ## TODO
11 |
12 | - [x] Rewrite with Swift [CHTCollectionViewWaterfallLayout](https://github.com/chiahsien/CHTCollectionViewWaterfallLayout)
13 | - [x] ZoomTransition Implementation
14 | - [x] Add demo
15 |
16 | Something looks like below:
17 |
18 | 
19 |
20 | And this is my copy:
21 |
22 | 
23 |
24 | ## Creator
25 |
26 | [Nicholas Tau](http://blog.inico.me)
27 |
28 | ## License
29 |
30 | This is available under the MIT license. See the LICENSE file for more info.
31 |
--------------------------------------------------------------------------------