Skip to content

Commit a847bb3

Browse files
committed
Added members for cell and live kluster creation/viewing
1 parent fce66a4 commit a847bb3

File tree

14 files changed

+198
-180
lines changed

14 files changed

+198
-180
lines changed

Cluster.xcworkspace/xcuserdata/mafellows.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

Lines changed: 41 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,6 @@
33
type = "0"
44
version = "2.0">
55
<Breakpoints>
6-
<BreakpointProxy
7-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
8-
<BreakpointContent
9-
shouldBeEnabled = "Yes"
10-
ignoreCount = "0"
11-
continueAfterRunningActions = "No"
12-
filePath = "Cluster/MessagesTableViewController.swift"
13-
timestampString = "467751158.42826"
14-
startingColumnNumber = "9223372036854775807"
15-
endingColumnNumber = "9223372036854775807"
16-
startingLineNumber = "49"
17-
endingLineNumber = "49"
18-
landmarkName = "tableView(_:cellForRowAtIndexPath:)"
19-
landmarkType = "5">
20-
</BreakpointContent>
21-
</BreakpointProxy>
22-
<BreakpointProxy
23-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
24-
<BreakpointContent
25-
shouldBeEnabled = "Yes"
26-
ignoreCount = "0"
27-
continueAfterRunningActions = "No"
28-
filePath = "Cluster/MessagesTableViewController.swift"
29-
timestampString = "467751199.695427"
30-
startingColumnNumber = "9223372036854775807"
31-
endingColumnNumber = "9223372036854775807"
32-
startingLineNumber = "42"
33-
endingLineNumber = "42"
34-
landmarkName = "tableView(_:numberOfRowsInSection:)"
35-
landmarkType = "5">
36-
</BreakpointContent>
37-
</BreakpointProxy>
38-
<BreakpointProxy
39-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
40-
<BreakpointContent
41-
shouldBeEnabled = "Yes"
42-
ignoreCount = "0"
43-
continueAfterRunningActions = "No"
44-
filePath = "Cluster/MessagesTableViewController.swift"
45-
timestampString = "467751205.687116"
46-
startingColumnNumber = "9223372036854775807"
47-
endingColumnNumber = "9223372036854775807"
48-
startingLineNumber = "37"
49-
endingLineNumber = "37"
50-
landmarkName = "MessagesTableViewController"
51-
landmarkType = "3">
52-
</BreakpointContent>
53-
</BreakpointProxy>
54-
<BreakpointProxy
55-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
56-
<BreakpointContent
57-
shouldBeEnabled = "Yes"
58-
ignoreCount = "0"
59-
continueAfterRunningActions = "No"
60-
filePath = "Cluster/NewKlusterViewController.swift"
61-
timestampString = "469119532.655553"
62-
startingColumnNumber = "9223372036854775807"
63-
endingColumnNumber = "9223372036854775807"
64-
startingLineNumber = "172"
65-
endingLineNumber = "172"
66-
landmarkName = "createNewKlusterButtonClicked(_:)"
67-
landmarkType = "5">
68-
</BreakpointContent>
69-
</BreakpointProxy>
706
<BreakpointProxy
717
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
728
<BreakpointContent
@@ -89,13 +25,13 @@
8925
shouldBeEnabled = "Yes"
9026
ignoreCount = "0"
9127
continueAfterRunningActions = "No"
92-
filePath = "Cluster/ProfileViewController.swift"
93-
timestampString = "477858079.797541"
28+
filePath = "Cluster/NewKlusterViewController.swift"
29+
timestampString = "478030203.827531"
9430
startingColumnNumber = "9223372036854775807"
9531
endingColumnNumber = "9223372036854775807"
96-
startingLineNumber = "94"
97-
endingLineNumber = "94"
98-
landmarkName = "addPhotoClicked(_:)"
32+
startingLineNumber = "172"
33+
endingLineNumber = "172"
34+
landmarkName = "createNewKlusterButtonClicked(_:)"
9935
landmarkType = "5">
10036
</BreakpointContent>
10137
</BreakpointProxy>
@@ -105,14 +41,46 @@
10541
shouldBeEnabled = "Yes"
10642
ignoreCount = "0"
10743
continueAfterRunningActions = "No"
108-
filePath = "Cluster/ProfileViewController.swift"
109-
timestampString = "477858079.797541"
44+
filePath = "Cluster/MembersTableViewController.swift"
45+
timestampString = "478033678.455381"
11046
startingColumnNumber = "9223372036854775807"
11147
endingColumnNumber = "9223372036854775807"
112-
startingLineNumber = "40"
113-
endingLineNumber = "40"
48+
startingLineNumber = "26"
49+
endingLineNumber = "26"
11450
landmarkName = "viewDidLoad()"
11551
landmarkType = "5">
52+
<Locations>
53+
<Location
54+
shouldBeEnabled = "Yes"
55+
ignoreCount = "0"
56+
continueAfterRunningActions = "No"
57+
symbolName = "Cluster.MembersTableViewController.viewDidLoad (Cluster.MembersTableViewController)() -&gt; ()"
58+
moduleName = "Cluster"
59+
usesParentBreakpointCondition = "Yes"
60+
urlString = "file:///Users/mafellows/ios/Kluster/Cluster/MembersTableViewController.swift"
61+
timestampString = "478034489.458837"
62+
startingColumnNumber = "9223372036854775807"
63+
endingColumnNumber = "9223372036854775807"
64+
startingLineNumber = "26"
65+
endingLineNumber = "26"
66+
offsetFromSymbolStart = "84">
67+
</Location>
68+
<Location
69+
shouldBeEnabled = "Yes"
70+
ignoreCount = "0"
71+
continueAfterRunningActions = "No"
72+
symbolName = "Cluster.MembersTableViewController.(viewDidLoad (Cluster.MembersTableViewController) -&gt; () -&gt; ()).(closure #1)"
73+
moduleName = "Cluster"
74+
usesParentBreakpointCondition = "Yes"
75+
urlString = "file:///Users/mafellows/ios/Kluster/Cluster/MembersTableViewController.swift"
76+
timestampString = "478034489.459052"
77+
startingColumnNumber = "9223372036854775807"
78+
endingColumnNumber = "9223372036854775807"
79+
startingLineNumber = "27"
80+
endingLineNumber = "27"
81+
offsetFromSymbolStart = "28">
82+
</Location>
83+
</Locations>
11684
</BreakpointContent>
11785
</BreakpointProxy>
11886
</Breakpoints>

Cluster/Base.lproj/Main.storyboard

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
<rect key="frame" x="0.0" y="0.0" width="280" height="380"/>
217217
<autoresizingMask key="autoresizingMask"/>
218218
<subviews>
219-
<imageView contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="1" translatesAutoresizingMaskIntoConstraints="NO" id="gWe-vd-goW">
219+
<imageView contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="1" translatesAutoresizingMaskIntoConstraints="NO" id="gWe-vd-goW" customClass="PFImageView">
220220
<rect key="frame" x="0.0" y="0.0" width="280" height="380"/>
221221
<gestureRecognizers/>
222222
<connections>
@@ -349,7 +349,7 @@
349349
</constraints>
350350
<connections>
351351
<outlet property="distanceLabel" destination="WhN-uo-jiI" id="qtH-ek-9hu"/>
352-
<outlet property="featuredImageView" destination="gWe-vd-goW" id="yZr-nl-xD2"/>
352+
<outlet property="featuredImageView" destination="gWe-vd-goW" id="PlM-QW-6e2"/>
353353
<outlet property="joinKlusterButton" destination="sde-nq-4c2" id="Tew-QZ-fAf"/>
354354
<outlet property="klusterTitleLabel" destination="mcx-Oc-4nR" id="E5i-VM-C1A"/>
355355
</connections>
@@ -1461,6 +1461,7 @@
14611461
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
14621462
<size key="freeformSize" width="600" height="1200"/>
14631463
<connections>
1464+
<outlet property="ageLabel" destination="6G2-dD-aoK" id="bTw-Ie-PGg"/>
14641465
<outlet property="coverImage" destination="4th-al-Vy1" id="J3B-OA-Dwi"/>
14651466
<outlet property="editButton" destination="YPD-vd-zbQ" id="mLd-pS-D6B"/>
14661467
<outlet property="menuButton" destination="RxG-pW-nCC" id="RBu-x0-Iy0"/>
@@ -2048,7 +2049,7 @@
20482049
</tableViewController>
20492050
<placeholder placeholderIdentifier="IBFirstResponder" id="kMs-Ye-T58" userLabel="First Responder" sceneMemberID="firstResponder"/>
20502051
</objects>
2051-
<point key="canvasLocation" x="1663" y="1149"/>
2052+
<point key="canvasLocation" x="1503" y="1159"/>
20522053
</scene>
20532054
<!--Members Table View Controller-->
20542055
<scene sceneID="uSg-tu-NJ6">
@@ -2066,12 +2067,17 @@
20662067
<rect key="frame" x="0.0" y="0.0" width="600" height="67.5"/>
20672068
<autoresizingMask key="autoresizingMask"/>
20682069
<subviews>
2069-
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="profile1" translatesAutoresizingMaskIntoConstraints="NO" id="l5k-c1-Sqs">
2070+
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="profile1" translatesAutoresizingMaskIntoConstraints="NO" id="l5k-c1-Sqs" customClass="PFImageView">
20702071
<rect key="frame" x="8" y="8" width="50" height="50"/>
20712072
<constraints>
20722073
<constraint firstAttribute="width" constant="50" id="Akr-Ej-Ode"/>
20732074
<constraint firstAttribute="height" constant="50" id="XWa-vB-cZl"/>
20742075
</constraints>
2076+
<userDefinedRuntimeAttributes>
2077+
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
2078+
<integer key="value" value="25"/>
2079+
</userDefinedRuntimeAttribute>
2080+
</userDefinedRuntimeAttributes>
20752081
</imageView>
20762082
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Michael Fellows" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iY3-9w-MFL">
20772083
<rect key="frame" x="66" y="13" width="526" height="23"/>
@@ -2100,6 +2106,11 @@
21002106
<constraint firstItem="iY3-9w-MFL" firstAttribute="leading" secondItem="l5k-c1-Sqs" secondAttribute="trailing" constant="8" id="vpq-T0-tPy"/>
21012107
</constraints>
21022108
</tableViewCellContentView>
2109+
<connections>
2110+
<outlet property="ageLabel" destination="eYn-6z-dRX" id="rTx-Lp-YMP"/>
2111+
<outlet property="avatarImageView" destination="l5k-c1-Sqs" id="C9T-xk-Bcs"/>
2112+
<outlet property="nameLabel" destination="iY3-9w-MFL" id="Ug4-kF-B8p"/>
2113+
</connections>
21032114
</tableViewCell>
21042115
</prototypes>
21052116
<connections>

Cluster/HomeViewController.swift

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class HomeViewController: UIViewController {
2020
@IBOutlet weak var profileAvatar: PFImageView!
2121

2222
//MARK: - UICollectionViewDataSource
23-
private var klusters = Kluster.createKlusters()
23+
private var klusters = [PFObject]()
2424

2525
//MARK: - Change Status Bar to White
2626
override func preferredStatusBarStyle() -> UIStatusBarStyle {
@@ -48,6 +48,12 @@ class HomeViewController: UIViewController {
4848
}
4949
}
5050

51+
override func viewWillAppear(animated: Bool) {
52+
super.viewWillAppear(true)
53+
54+
self.fetchKlusters()
55+
}
56+
5157
private func showLogin() {
5258
let storyboard = UIStoryboard.init(name: "Login", bundle: nil)
5359
let loginVC = storyboard.instantiateViewControllerWithIdentifier("LoginViewController") as! LoginViewController
@@ -60,6 +66,17 @@ class HomeViewController: UIViewController {
6066
let navigationController = UINavigationController.init(rootViewController: searchController)
6167
self.presentViewController(navigationController, animated: true, completion: nil)
6268
}
69+
70+
private func fetchKlusters() {
71+
KlusterDataSource.fetchKlustersForUser { (object, error) -> Void in
72+
if (error != nil) {
73+
print("Error: %@", error?.localizedDescription)
74+
} else {
75+
self.klusters = object as! [PFObject]
76+
self.collectionView.reloadData()
77+
}
78+
}
79+
}
6380
}
6481

6582
extension HomeViewController : UICollectionViewDataSource
@@ -69,18 +86,33 @@ extension HomeViewController : UICollectionViewDataSource
6986
}
7087

7188
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
72-
return klusters.count
89+
return self.klusters.count
7390
}
7491

7592
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
7693

7794
let cellIdentifier = "Kluster Cell"
7895
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(cellIdentifier, forIndexPath: indexPath) as! KlusterCollectionViewCell
7996

80-
cell.kluster = self.klusters[indexPath.item]
97+
let k = Kluster.init(object: self.klusters[indexPath.item])
98+
cell.kluster = k
8199
cell.joinKlusterButton.tag = indexPath.row
82100
cell.joinKlusterButton.addTarget(self, action: "joinKluster:", forControlEvents: UIControlEvents.TouchUpInside)
83101

102+
// Moved the PFImageView loading out of the cell
103+
cell.featuredImageView.image = nil
104+
cell.featuredImageView.file = k.featuredImageFile
105+
cell.featuredImageView.loadInBackground { (image, error) -> Void in
106+
if (error != nil) {
107+
print("Error loading image...")
108+
} else {
109+
print("Finished loading image...")
110+
dispatch_async(dispatch_get_main_queue(), { () -> Void in
111+
cell.featuredImageView.image = image
112+
});
113+
}
114+
}
115+
84116
let tapRecognizer = UITapGestureRecognizer.init(target: self, action: "featuredImageViewTapped:")
85117
cell.featuredImageView.addGestureRecognizer(tapRecognizer)
86118

@@ -90,6 +122,8 @@ extension HomeViewController : UICollectionViewDataSource
90122
func featuredImageViewTapped(sender: UITapGestureRecognizer) {
91123
let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
92124
let klusterVC = storyboard.instantiateViewControllerWithIdentifier("KlusterViewController") as! KlusterViewController;
125+
let k = Kluster.init(object: self.klusters[(sender.view?.tag)!])
126+
klusterVC.kluster = k
93127

94128
// Show kluster
95129
let navigationController = UINavigationController.init(rootViewController: klusterVC)

0 commit comments

Comments
 (0)