File tree Expand file tree Collapse file tree
Resources/CoreData/EasyReader.xcdatamodeld/api_v2.xcdatamodel Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,8 +98,13 @@ - (void) setupFeedItemObserver
9898
9999- (void )setUpCollectionView
100100{
101- NSArray *feedItems = [FeedItem MR_findAll ];
102-
101+ // User *current = [User current];
102+ //
103+ // NSSet *feedItems = current.feedItems;
104+
105+ NSArray *feedItems = [FeedItem MR_findAll ];
106+ FeedItem *first = feedItems[0 ];
107+ NSLog (@" %@ " , first.name );
103108 feedCollectionViewDataSource =
104109 [[CSFeedItemCollectionViewDataSource alloc ] initWithFeedItems: feedItems
105110 reusableCellIdentifier: @" feedItemCell"
Original file line number Diff line number Diff line change 2525// / The users feeds
2626@property (nonatomic , retain ) NSSet *feeds;
2727
28+ // / The items in a users feeds
29+ @property (nonatomic , readonly ) NSSet *feedItems;
30+
2831
2932#pragma mark - Methods
3033
Original file line number Diff line number Diff line change 1313@implementation User
1414
1515@dynamic feeds;
16+ @dynamic feedItems;
17+
18+ /* *
19+ * Gathers all the items in a users feeds
20+ */
21+ - (NSSet *)feedItems
22+ {
23+ NSMutableSet *feedItems = [[NSMutableSet alloc ] init ];
24+
25+ for (Feed *feed in self.feeds )
26+ {
27+ [feedItems setByAddingObjectsFromSet: feed.feedItems];
28+ }
29+
30+ return feedItems;
31+ }
1632
1733/* *
1834 * Returns the current user.
Original file line number Diff line number Diff line change 1717 <rect key =" frame" x =" 0.0" y =" 0.0" width =" 320" height =" 568" />
1818 <autoresizingMask key =" autoresizingMask" flexibleMaxX =" YES" flexibleMaxY =" YES" />
1919 <subviews >
20- <scrollView clipsSubviews =" YES" multipleTouchEnabled =" YES" contentMode =" scaleToFill" fixedFrame =" YES" bounces =" NO" alwaysBounceVertical =" YES" showsHorizontalScrollIndicator =" NO" showsVerticalScrollIndicator =" NO" translatesAutoresizingMaskIntoConstraints =" NO" id =" EWA-9Z-pb1" >
20+ <scrollView clipsSubviews =" YES" multipleTouchEnabled =" YES" contentMode =" scaleToFill" ambiguous = " YES " misplaced =" YES" bounces =" NO" alwaysBounceVertical =" YES" showsHorizontalScrollIndicator =" NO" showsVerticalScrollIndicator =" NO" translatesAutoresizingMaskIntoConstraints =" NO" id =" EWA-9Z-pb1" >
2121 <rect key =" frame" x =" 0.0" y =" 0.0" width =" 320" height =" 568" />
2222 <autoresizingMask key =" autoresizingMask" flexibleMaxX =" YES" flexibleMinY =" YES" />
2323 <subviews >
141141 </constraints >
142142 </pageControl >
143143 </subviews >
144+ <constraints >
145+ <constraint firstAttribute =" trailing" secondItem =" vdW-Yb-aAb" secondAttribute =" trailing" id =" Bcm-5I-kx3" />
146+ <constraint firstItem =" vdW-Yb-aAb" firstAttribute =" leading" secondItem =" EWA-9Z-pb1" secondAttribute =" leading" id =" ct5-rK-kEl" />
147+ </constraints >
144148 </scrollView >
145149 </subviews >
146150 <color key =" backgroundColor" white =" 1" alpha =" 1" colorSpace =" custom" customColorSpace =" calibratedWhite" />
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" standalone =" yes" ?>
2- <model userDefinedModelVersionIdentifier =" " type =" com.apple.IDECoreDataModeler.DataModel" documentVersion =" 1.0" lastSavedToolsVersion =" 3401 " systemVersion =" 12F45 " minimumToolsVersion =" Xcode 4.3" macOSVersion =" Automatic" iOSVersion =" Automatic" >
2+ <model userDefinedModelVersionIdentifier =" " type =" com.apple.IDECoreDataModeler.DataModel" documentVersion =" 1.0" lastSavedToolsVersion =" 5063 " systemVersion =" 13C64 " minimumToolsVersion =" Xcode 4.3" macOSVersion =" Automatic" iOSVersion =" Automatic" >
33 <entity name =" Feed" representedClassName =" Feed" syncable =" YES" >
44 <attribute name =" icon" optional =" YES" attributeType =" String" syncable =" YES" />
55 <attribute name =" id" optional =" YES" attributeType =" Integer 16" defaultValueString =" 0" syncable =" YES" />
2323 <relationship name =" feeds" optional =" YES" toMany =" YES" deletionRule =" Nullify" destinationEntity =" Feed" inverseName =" user" inverseEntity =" Feed" syncable =" YES" />
2424 </entity >
2525 <elements >
26- <element name =" Feed" positionX =" 0" positionY =" 0" width =" 0 " height =" 0 " />
27- <element name =" FeedItem" positionX =" 0" positionY =" 0" width =" 0 " height =" 0 " />
28- <element name =" User" positionX =" 0" positionY =" 0" width =" 0 " height =" 0 " />
26+ <element name =" Feed" positionX =" 0" positionY =" 0" width =" 128 " height =" 135 " />
27+ <element name =" FeedItem" positionX =" 0" positionY =" 0" width =" 128 " height =" 178 " />
28+ <element name =" User" positionX =" 0" positionY =" 0" width =" 128 " height =" 58 " />
2929 </elements >
3030</model >
You can’t perform that action at this time.
0 commit comments