diff --git a/Classes/DetailTableViewController.m b/Classes/DetailTableViewController.m
index cde2bdc..a5e4a05 100644
--- a/Classes/DetailTableViewController.m
+++ b/Classes/DetailTableViewController.m
@@ -31,7 +31,7 @@
#import "NSString+HTML.h"
typedef enum { SectionHeader, SectionDetail } Sections;
-typedef enum { SectionHeaderTitle, SectionHeaderDate, SectionHeaderURL, SectionHeaderAuthor } HeaderRows;
+typedef enum { SectionHeaderTitle, SectionHeaderDate, SectionHeaderURL, SectionHeaderAuthor, SectionHeaderCategories } HeaderRows;
typedef enum { SectionDetailSummary } DetailRows;
@implementation DetailTableViewController
@@ -85,7 +85,7 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
switch (section) {
- case 0: return 4;
+ case 0: return 5;
default: return 1;
}
}
@@ -130,6 +130,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
case SectionHeaderAuthor:
cell.textLabel.text = item.author ? item.author : @"[No Author]";
break;
+ case SectionHeaderCategories:
+ cell.textLabel.font = [UIFont systemFontOfSize:8];
+ cell.textLabel.numberOfLines = 2;
+ cell.textLabel.text = item.categories.count ? [item.categories componentsJoinedByString:@", "] : @"[No Categories]";
+ break;
}
break;
diff --git a/Classes/MWFeedItem.h b/Classes/MWFeedItem.h
index 47bea85..c05dc99 100644
--- a/Classes/MWFeedItem.h
+++ b/Classes/MWFeedItem.h
@@ -39,6 +39,7 @@
NSString *summary; // Description of item
NSString *content; // More detailed content (if available)
NSString *author; // Item author
+ NSArray *categories; // Array of categories as NSStrings (if available)
// Enclosures: Holds 1 or more item enclosures (i.e. podcasts, mp3. pdf, etc)
// - NSArray of NSDictionaries with the following keys:
@@ -57,6 +58,7 @@
@property (nonatomic, copy) NSString *summary;
@property (nonatomic, copy) NSString *content;
@property (nonatomic, copy) NSString *author;
+@property (nonatomic, copy) NSArray *categories;
@property (nonatomic, copy) NSArray *enclosures;
@end
diff --git a/Classes/MWFeedItem.m b/Classes/MWFeedItem.m
index 7ccb7e4..6c78f41 100644
--- a/Classes/MWFeedItem.m
+++ b/Classes/MWFeedItem.m
@@ -59,6 +59,7 @@ - (id)initWithCoder:(NSCoder *)decoder {
summary = [decoder decodeObjectForKey:@"summary"];
content = [decoder decodeObjectForKey:@"content"];
author = [decoder decodeObjectForKey:@"author"];
+ categories = [decoder decodeObjectForKey:@"categories"];
enclosures = [decoder decodeObjectForKey:@"enclosures"];
}
return self;
@@ -73,6 +74,7 @@ - (void)encodeWithCoder:(NSCoder *)encoder {
if (summary) [encoder encodeObject:summary forKey:@"summary"];
if (content) [encoder encodeObject:content forKey:@"content"];
if (author) [encoder encodeObject:author forKey:@"author"];
+ if (categories) [encoder encodeObject:categories forKey:@"categories"];
if (enclosures) [encoder encodeObject:enclosures forKey:@"enclosures"];
}
diff --git a/Classes/MWFeedParser.m b/Classes/MWFeedParser.m
index 7d900ad..59ed66a 100644
--- a/Classes/MWFeedParser.m
+++ b/Classes/MWFeedParser.m
@@ -602,6 +602,7 @@ - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
else if ([currentPath isEqualToString:@"/rss/channel/item/content:encoded"]) { if (processedText.length > 0) item.content = processedText; processed = YES; }
else if ([currentPath isEqualToString:@"/rss/channel/item/pubDate"]) { if (processedText.length > 0) item.date = [NSDate dateFromInternetDateTimeString:processedText formatHint:DateFormatHintRFC822]; processed = YES; }
else if ([currentPath isEqualToString:@"/rss/channel/item/enclosure"]) { [self createEnclosureFromAttributes:currentElementAttributes andAddToItem:item]; processed = YES; }
+ else if ([currentPath isEqualToString:@"/rss/channel/item/category"]) { if (processedText.length > 0) [self addCategory:processedText toItem:item]; processed = YES; }
else if ([currentPath isEqualToString:@"/rss/channel/item/dc:date"]) { if (processedText.length > 0) item.date = [NSDate dateFromInternetDateTimeString:processedText formatHint:DateFormatHintRFC3339]; processed = YES; }
}
@@ -657,6 +658,7 @@ - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
else if ([currentPath isEqualToString:@"/feed/entry/author/name"]) { if (processedText.length > 0) item.author = processedText; processed = YES; }
else if ([currentPath isEqualToString:@"/feed/entry/dc:creator"]) { if (processedText.length > 0) item.author = processedText; processed = YES; }
else if ([currentPath isEqualToString:@"/feed/entry/published"]) { if (processedText.length > 0) item.date = [NSDate dateFromInternetDateTimeString:processedText formatHint:DateFormatHintRFC3339]; processed = YES; }
+ else if ([currentPath isEqualToString:@"/feed/entry/category"]) { if (processedText.length > 0) [self addCategory:processedText toItem:item]; processed = YES; }
else if ([currentPath isEqualToString:@"/feed/entry/updated"]) { if (processedText.length > 0) item.updated = [NSDate dateFromInternetDateTimeString:processedText formatHint:DateFormatHintRFC3339]; processed = YES; }
}
@@ -923,6 +925,18 @@ - (BOOL)createEnclosureFromAttributes:(NSDictionary *)attributes andAddToItem:(M
}
+// Add a category to a given item
+- (BOOL)addCategory:(NSString *)category toItem:(MWFeedItem *)currentItem {
+ if (currentItem.categories) {
+ currentItem.categories = [currentItem.categories arrayByAddingObject:category];
+ return YES;
+ } else {
+ currentItem.categories = [NSArray arrayWithObject:category];
+ return YES;
+ }
+ return NO;
+}
+
// Process ATOM link and determine whether to ignore it, add it as the link element or add as enclosure
// Links can be added to MWObject (info or item)
- (BOOL)processAtomLink:(NSDictionary *)attributes andAddToMWObject:(id)MWObject {
@@ -946,4 +960,4 @@ - (BOOL)processAtomLink:(NSDictionary *)attributes andAddToMWObject:(id)MWObject
return NO;
}
-@end
\ No newline at end of file
+@end
diff --git a/Classes/MWFeedParserAppDelegate.m b/Classes/MWFeedParserAppDelegate.m
index 13f8149..b0ee0ce 100644
--- a/Classes/MWFeedParserAppDelegate.m
+++ b/Classes/MWFeedParserAppDelegate.m
@@ -39,8 +39,9 @@ @implementation MWFeedParserAppDelegate
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- // Override point for customization after app launch
- [window addSubview:[navigationController view]];
+ // Override point for customization after app launch
+ [window setRootViewController:navigationController];
+ [window addSubview:[navigationController view]];
[window makeKeyAndVisible];
return YES;
}
diff --git a/Classes/RootViewController.m b/Classes/RootViewController.m
index f11ac8f..80c87f9 100644
--- a/Classes/RootViewController.m
+++ b/Classes/RootViewController.m
@@ -57,9 +57,8 @@ - (void)viewDidLoad {
target:self
action:@selector(refresh)];
// Parse
-// NSURL *feedURL = [NSURL URLWithString:@"http://images.apple.com/main/rss/hotnews/hotnews.rss"];
-// NSURL *feedURL = [NSURL URLWithString:@"http://feeds.mashable.com/Mashable"];
- NSURL *feedURL = [NSURL URLWithString:@"http://techcrunch.com/feed/"];
+// NSURL *feedURL = [NSURL URLWithString:@"https://images.apple.com/main/rss/hotnews/hotnews.rss"];
+ NSURL *feedURL = [NSURL URLWithString:@"https://techcrunch.com/feed/"];
feedParser = [[MWFeedParser alloc] initWithFeedURL:feedURL];
feedParser.delegate = self;
feedParser.feedParseType = ParseTypeFull; // Parse feed info and all items
diff --git a/MWFeedParser.xcodeproj/project.pbxproj b/MWFeedParser.xcodeproj/project.pbxproj
index f7f461c..776019b 100755
--- a/MWFeedParser.xcodeproj/project.pbxproj
+++ b/MWFeedParser.xcodeproj/project.pbxproj
@@ -324,7 +324,7 @@
GCC_VERSION = com.apple.compilers.llvmgcc42;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
@@ -340,7 +340,7 @@
GCC_VERSION = com.apple.compilers.llvmgcc42;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
};
diff --git a/MainWindow.xib b/MainWindow.xib
index 33bce64..af720cb 100644
--- a/MainWindow.xib
+++ b/MainWindow.xib
@@ -1,279 +1,46 @@
-
-
- 800
- 10D541
- 760
- 1038.29
- 460.00
-
-
-
-
-
- YES
-
- IBFilesOwner
- IBCocoaTouchFramework
-
-
- IBFirstResponder
- IBCocoaTouchFramework
-
-
- IBCocoaTouchFramework
-
-
-
- 1316
-
- {320, 480}
-
- 1
- MSAxIDEAA
-
- NO
- NO
-
- IBCocoaTouchFramework
- YES
-
-
-
- IBCocoaTouchFramework
-
-
- 256
- {0, 0}
- NO
- YES
- YES
- IBCocoaTouchFramework
-
-
- YES
-
-
-
- IBCocoaTouchFramework
-
-
- RootViewController
-
- IBCocoaTouchFramework
-
-
-
-
-
-
- YES
-
-
- delegate
-
-
-
- 4
-
-
-
- window
-
-
-
- 5
-
-
-
- navigationController
-
-
-
- 15
-
-
-
-
- YES
-
- 0
-
-
-
-
-
- 2
-
-
- YES
-
-
-
-
- -1
-
-
- File's Owner
-
-
- 3
-
-
-
-
- -2
-
-
-
-
- 9
-
-
- YES
-
-
-
-
-
-
- 11
-
-
-
-
- 13
-
-
- YES
-
-
-
-
-
- 14
-
-
-
-
-
-
- YES
-
- YES
- -1.CustomClassName
- -2.CustomClassName
- 11.IBPluginDependency
- 13.CustomClassName
- 13.IBPluginDependency
- 2.IBAttributePlaceholdersKey
- 2.IBEditorWindowLastContentRect
- 2.IBPluginDependency
- 3.CustomClassName
- 3.IBPluginDependency
- 9.IBEditorWindowLastContentRect
- 9.IBPluginDependency
-
-
- YES
- UIApplication
- UIResponder
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
- RootViewController
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
-
- YES
-
-
- YES
-
-
- {{673, 376}, {320, 480}}
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
- MWFeedParserAppDelegate
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
- {{186, 376}, {320, 480}}
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
-
-
-
- YES
-
-
- YES
-
-
-
-
- YES
-
-
- YES
-
-
-
- 15
-
-
-
- YES
-
- RootViewController
- UITableViewController
-
- IBProjectSource
- Classes/RootViewController.h
-
-
-
- MWFeedParserAppDelegate
- NSObject
-
- YES
-
- YES
- navigationController
- window
-
-
- YES
- UINavigationController
- UIWindow
-
-
-
- IBProjectSource
- Classes/MWFeedParserAppDelegate.h
-
-
-
-
- 0
- IBCocoaTouchFramework
-
- com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3
-
-
- YES
- MWFeedParser.xcodeproj
- 3
- 81
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/RootViewController.xib b/RootViewController.xib
index 60302b2..b1dc364 100644
--- a/RootViewController.xib
+++ b/RootViewController.xib
@@ -1,384 +1,30 @@
-
-
- 784
- 10D541
- 760
- 1038.29
- 460.00
-
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
- 81
-
-
- YES
-
-
-
- YES
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
-
-
- YES
-
- YES
-
-
- YES
-
-
-
- YES
-
- IBFilesOwner
- IBCocoaTouchFramework
-
-
- IBFirstResponder
- IBCocoaTouchFramework
-
-
-
- 274
- {320, 247}
-
-
- 3
- MQA
-
- NO
- YES
- NO
- IBCocoaTouchFramework
- NO
- 1
- 0
- YES
- 44
- 22
- 22
-
-
-
-
- YES
-
-
- view
-
-
-
- 3
-
-
-
- dataSource
-
-
-
- 4
-
-
-
- delegate
-
-
-
- 5
-
-
-
-
- YES
-
- 0
-
-
-
-
-
- -1
-
-
- File's Owner
-
-
- -2
-
-
-
-
- 2
-
-
-
-
-
-
- YES
-
- YES
- -1.CustomClassName
- -2.CustomClassName
- 2.IBEditorWindowLastContentRect
- 2.IBPluginDependency
-
-
- YES
- RootViewController
- UIResponder
- {{144, 609}, {320, 247}}
- com.apple.InterfaceBuilder.IBCocoaTouchPlugin
-
-
-
- YES
-
-
- YES
-
-
-
-
- YES
-
-
- YES
-
-
-
- 5
-
-
-
- YES
-
- RootViewController
- UITableViewController
-
- IBProjectSource
- Classes/RootViewController.h
-
-
-
-
- YES
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSError.h
-
-
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSFileManager.h
-
-
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSKeyValueCoding.h
-
-
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSKeyValueObserving.h
-
-
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSKeyedArchiver.h
-
-
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSNetServices.h
-
-
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSObject.h
-
-
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSPort.h
-
-
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSRunLoop.h
-
-
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSStream.h
-
-
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSThread.h
-
-
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSURL.h
-
-
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSURLConnection.h
-
-
-
- NSObject
-
- IBFrameworkSource
- Foundation.framework/Headers/NSXMLParser.h
-
-
-
- NSObject
-
- IBFrameworkSource
- UIKit.framework/Headers/UIAccessibility.h
-
-
-
- NSObject
-
- IBFrameworkSource
- UIKit.framework/Headers/UINibLoading.h
-
-
-
- NSObject
-
- IBFrameworkSource
- UIKit.framework/Headers/UIResponder.h
-
-
-
- UIResponder
- NSObject
-
-
-
- UIScrollView
- UIView
-
- IBFrameworkSource
- UIKit.framework/Headers/UIScrollView.h
-
-
-
- UISearchBar
- UIView
-
- IBFrameworkSource
- UIKit.framework/Headers/UISearchBar.h
-
-
-
- UISearchDisplayController
- NSObject
-
- IBFrameworkSource
- UIKit.framework/Headers/UISearchDisplayController.h
-
-
-
- UITableView
- UIScrollView
-
- IBFrameworkSource
- UIKit.framework/Headers/UITableView.h
-
-
-
- UITableViewController
- UIViewController
-
- IBFrameworkSource
- UIKit.framework/Headers/UITableViewController.h
-
-
-
- UIView
-
- IBFrameworkSource
- UIKit.framework/Headers/UITextField.h
-
-
-
- UIView
- UIResponder
-
- IBFrameworkSource
- UIKit.framework/Headers/UIView.h
-
-
-
- UIViewController
-
- IBFrameworkSource
- UIKit.framework/Headers/UINavigationController.h
-
-
-
- UIViewController
-
- IBFrameworkSource
- UIKit.framework/Headers/UITabBarController.h
-
-
-
- UIViewController
- UIResponder
-
- IBFrameworkSource
- UIKit.framework/Headers/UIViewController.h
-
-
-
-
- 0
- IBCocoaTouchFramework
-
- com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS
-
-
-
- com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3
-
-
- YES
- MWFeedParser.xcodeproj
- 3
- 81
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+